<el-table> <el-table-column prop="demo" label="举例"> <template slot-scope="scope"> <span :style="{color:'#fff200'}">{{scope.row.demo}}</span> </template> </el-table-column> </el-table>
插槽slot-scope已经不用了,改成v-slot成功,否则报错读不到row
正确代码:
<el-table> <el-table-column prop="demo" label="举例"> <template v-slot="scope"> <span :style="{color:'#fff200'}">{{scope.row.demo}}</span> </template> </el-table-column> </el-table>
参考:el-table显示图片报错Cannot read properties of undefined (reading ‘row‘)_涵涵学前端的博客-CSDN博客