<el-table @row-click="clickRow" ref="moviesTable" :data="insertModel.tableData"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"/>
<el-table-column prop="name" label="电影名称" align="center" show-overflow-tooltip/>
<el-table-column prop="movieType" label="分类" width="100" align="center" :formatter="formatType"/>
</el-table>
<script>
export default {
methods: {
clickRow(row){
this.$refs.moviesTable.toggleRowSelection(row)
}
}
};
</script>
/* 在<el-table>标签中绑定
@row-click="clickRow" 单击事件 和 ref="moviesTable"属性
然后再单击事件的方法中,写
this.$refs.moviesTable.toggleRowSelection(row)
原文地址:https://www.cnblogs.com/yixiaoyang-/p/9779924.html