Property or method “prop” is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property
父子组件传值:遇到的bug
Property or method “prop” is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property
子组件

props: {
    searchFrom: {
      type: Array,
      default: [],
    },
    tableData: {
      type: Object,
      default: {},
    },
    tableColumn: {
      type: Array,
      default: [],
    },
    searchText: {
      type: String,
      default: "",
    },
  },

父组件 嵌套

 <CommonTable
   key="customCode-product"
    :searchFrom="searchFrom"
    :tableData="tableData"
    :tableColumn="tableColumn"
    searchText="添加"
  ></CommonTable>

父组件data定义数据
 data() {
    return {
     
      searchFrom: [{ label: "姓名", prop: "customName", value: "" }],
      tableData: {
        total: 0,
        tableValue: [],
      },
      tableColumn: [
        { label: "客户ID", prop: "id" },
        { label: "客户编码", prop: "customCode" },
        { label: "客户名称", prop: "customName" },
        { label: "创建时间", prop: "createTime" },
      ],
    };
  },

为啥控制台报错啊

vue.runtime.esm.js:4605 [Vue warn]: Property or method “prop” is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property

Logo

前往低代码交流专区

更多推荐