el-table單擊某行,背景色改變:

<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>

單擊效果:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章