element-ui——el-table表格组件出现选择一行而全选框也被打上勾的情况

解决方案:给row-key值绑定一个唯一值

行数据的 Key,用来优化 Table 的渲染;在使用 reserve-selection 功能与显示树形数据时,该属性是必填的。类型为 String 时,支持多层访问:user.info.id,但不支持 user.info[0].id,此种情况请使用 Function

 <el-table
    ref="multipleTable"
    :data="tableData"
    tooltip-effect="dark"
    style="width: 100%"
    row-key="id"
    @selection-change="handleSelectionChange">
</el-table>

data () {
    return {
    tableData: [
{
  id: 1,
  address: 'A'
},
{
  id: 2,
  address: 'B'
},
]
    }
}
methods: {
    handleSelectionChange(val) {
        this.multipleSelection = val;
    }
}

猜你喜欢

转载自blog.csdn.net/qq_43201350/article/details/120398732