antd-vue中,点击列表行高亮效果实现

       <a-table
          class="table"
          :columns="columns"
          :data-source="tableData"
          :scroll="{ x: '13.5rem', y: tableSize === 'normal' ? '2.3rem' : null }"
          :pagination="{
            pageSize: tableSize === 'normal' ? 10 : show ? 16 : 18,
            current: current,
            onChange: onPageChange,
          }"
          :rowKey="(record, index) => index"
          :customRow="customRow"  // 
          :rowClassName="rowClassName" // 
        >
        </a-table>
methods: {
    customRow(record) {
      return {
        on: {
          click: () => {
            this.updateState({ tableCurrRowId: record.id });
            this.OLPoints.locateFeature(record);
          },
        },
      };
    },
    rowClassName(record) {
      return record.id === this.tableCurrRowId ? 'customBlue' : null; // 指定行,增加customBlue的class效果
    },
}
<style scoped lang="scss">
/deep/.ant-table-tbody .customBlue {
    background: #d8e6fa !important;
}
</style>

 

上一篇:React实践报错:TypeError: date.clone is not a function, antd DatePicker报错


下一篇:OpenStack 学习资料总结