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

Vue2年前 (2022)发布 小马大哥哥
568 0 0
<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>

 

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...