<el-table
highlight-current-row="true"
@row-click="openDetails"
>
</el-table>
<script>
methods: {
openDetails(row) {
this.crud.selections = [];
this.crud.selections.push(row);
this.$refs.table.clearSelection();
this.$refs.table.toggleRowSelection(row);
}
}
</script>
<style>
/* 用來設置當前頁面element全局table 選中某行時的背景色*/
/deep/ .el-table__body tr.current-row>td{
background-color: #E7F6F5 !important;
}
</style>
單擊效果: