项目场景:
使用Element中的el-table生成表格时,控制台报错:“Error: row is required when get row identity”
错误信息如下:
原因分析:
- 未添加row-key属性
- tableList类型不为[]
- 当调用getRowIdentity函数,但是参数为空的时候会触发,查看用了哪些el-table自带的方法
let row = this.deviceList.filter(item => item.deviceId == this.form.ledDeviceId)[0]; if (row) { this.$refs.equipmentTable.toggleRowSelection(row); }