1.实用场景
我需要对表格中的多行数据进行一次集体操作,比如发短信,怎么拿到选中的数据呢
2.代码实现
<el-table
:data="tableData"
ref="registTable"
>
<el-table-column type="selection" min-width="2%"> </el-table-column>
</el-table>
//js
//点击提醒按钮获取数据
messageRemind() {
console.log(this.$refs.registTable.selection)
},
这样就可以拿到数据了的,需要注意的是,表格设置ref,column设置type=“selection”,最后拿数据时一一对应就行了