Property or method "id" is not defined on the instance but referenced during render.
微wx笑 2021-01-12【前端开发】 4 0关键字: element el-table property
[Vue warn]: Property or method "id" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data op
[Vue warn]: Property or method "id" 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. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
found in
---> <List> at src/views/cmscategory/list.vue
<AppMain> at src/layout/components/AppMain.vue
<Layout> at src/layout/index.vue
<App> at src/App.vue
<Root>
el-table 指定 row-key的时候,使用“:row-key="id"”的时候就会出现些错误,这时它会认为“id”是一个变量或方法,而我没有定义;
我为什么要使用“:row-key="id"”呢?因为不加冒号的时候,id字段本身是数字类型,它会默认给转换为字符串类型。
本文由 微wx笑 创作,采用 署名-非商业性使用-相同方式共享 4.0 许可协议,转载请附上原文出处链接及本声明。
原文链接:https://www.ivu4e.cn/blog/front/2021-01-12/602.html