效果
左边的是第一种方式,右边的是第二种方式
第一种方式
直接指定type为selection,并且在table标签中指定处理方法,即@selection-change="handleSelectionChange"
<el-table-column
type = 'selection'
label="是否选中"
width="55">
</el-table-column>
handleSelectionChange:function(val) {
this.multipleSelection = val;
console.log(val)
}
第二种方式
<el-table-column
label="是否选中"
width="55">
<template scope="scope">
<el-checkbox v-model="scope.row.checked"></el-checkbox> // 添加一个多选框,控制选中与否
</template>
</el-table-column>