Ant Design of Vue table表格 点击一行选中效果

点击一行并选中(可获取该行数据),改变颜色 

    <s-table
        ref="table"
        rowKey="key"
        bordered
        :columns="columns"
        :data="loadData"
        showPagination="auto"
        :customRow="customRow"
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio' }"
      >
        <span slot="serial" slot-scope="text, record, index">
          {{ index + 1 }}
        </span>
      </s-table>
  computed: {
    rowSelection () {
      return {
        selectedRowKeys: this.selectedRowKeys,
        onChange: this.onSelectChange
      }
    }
  }
    customRow (record, index) {
      return {
        on: {
          click: (e) => {
            console.log(record, index)
            this.selectedRowKeys = [index]
            this.selectedRows = [record]
          }
        }
      }
    },
    onSelectChange (selectedRowKeys, selectedRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectedRows = selectedRows
    },
原文地址:https://www.cnblogs.com/caoxen/p/13936908.html