<el-table @row-click="clickRow" ref="tb" :data="tbData" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55"/> <el-table-column prop="name" label="姓名" /> <el-table-column prop="movieType" label="电话"/> </el-table> <script> export default { methods: { clickRow(row){ this.$refs.tb.toggleRowSelection(row); } } };
/* 在<el-table>标签中绑定
@row-click="clickRow" 单击事件 和 ref="moviesTable"属性
然后再单击事件的方法中,写
this.$refs.tb.toggleRowSelection(row)
*/
---------------------