element-ui的table表格勾选高亮当前行(亲测有效,拿过来直接用)

效果如图: 

element-ui的table表格勾选高亮当前行(亲测有效,拿过来直接用)_第1张图片

html: 

      

 methods:

    selectedHighlight ({ row, rowIndex }) {
      if (this.selectRow.includes(rowIndex)) {
        return {
          'background-color': '#15499A'
        }
      }
    },
    // 获取勾中表单
    handDrawer (val) {
      this.buttonList = val
    },

 watch:

  watch: {
    buttonList (data) {
      this.selectRow = []
      if (data.length > 0) {
        data.forEach((item, index) => {
          this.selectRow.push(this.tableData.indexOf(item))
        })
      }
    }
  },

亲测有效!

你可能感兴趣的:(element-ui的table表格勾选高亮当前行(亲测有效,拿过来直接用))