ant design vue 中 table 组件 选中的表格中的某一项高亮显示

ant design vue 中 table 组件 选中的表格中的某一项高亮显示

<template>
	<a-table
       rowKey="id"
       :columns="columns"
       :dataSource="tableList"
       :pagination="false"
       class="j-table-force-nowrap"
       :customRow="customRow"
       >
      </a-table>
</template>

export default class extends Vue {
	columns = ref<array>([]),
	tableList = ref<array>([]),
	leftAlignId = ref<string | number>("")
	 // 自定义行
       customRow(record, index) {
       	console.log(record, index)
         return {
           // 自定义属性,也就是官方文档中的props,可通过条件来控制样式
           style: {
             // 设置字体颜色
             // 'color': record.id === this.leftAlignId ? '#fff' : '',
             //  设置行背景色
             'background-color': record.id === this.leftAlignId ? '#E6F7FF' : ''
             // 设置字体类型
             // 'font-family': 'Microsoft YaHei',
             // // 下划线
             // 'text-decoration': 'underline',
             // // 字体样式-斜体
             // 'font-style': 'italic',
             // // 字体加粗
             // 'font-weight': 'bold'
           },
           onClick: (event: any) => {
           	// 记录当前点击的行标识
			this.leftAlignId = record.id
		},
         }
       },
}

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值