Property or method "id" is not defined on the instance but referenced during render.
微wx笑2021-01-12 11:26:45【前端开发】人已围观关键字:
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笑 创作,采用 CC BY-NC 4.0 许可协议。 非商业性使用可自由转载、引用、甚至修改,但需署名作者且注明出处。
上一篇:element-ui el-table js控制表格行展开和折叠
下一篇:返回列表