vue3.0引入elementUI报错:
111.png
子组件错误代码:
<el-table-column
align="center"
v-for="item in tableLabel"
:key="item.prop"
:label="item.label"
show-overflow-tooltip
>
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row[item.prop] }}</span>
</template>
</el-table-column>
</el-table>
- 这里slot-scope标红,并报错row is undefined
正确代码:使用v-slot
<el-table-column
align="center"
v-for="item in tableLabel"
:key="item.prop"
:label="item.label"
show-overflow-tooltip
>
<template v-slot="scope">
<span style="margin-left: 10px">{{ scope.row[item.prop] }}</span>
</template>
</el-table-column>
</el-table>
ps: 根据数据动态生成表格--》在elementUI专题文集里