html
<a-table
:scroll="{ x: 1500, y: 300 }
//设置横向或纵向滚动,也可用于指定滚动区域的宽和高
:customRow="customRow"
//设置行属性
:rowClassName="rowClassName"
//表格行的类名
:dataSource="dataSource"
//数据数组
:columns="columns" />
//表格列的配置描述
<script>
function customRow(record,index){
return {
xxx... //属性
onClick: (event) => {
this.rowindex = index
//点击那一行时保存index
},
// 点击行
onDblclick: (event) => {},
onContextmenu: (event) => {},
onMouseenter: (event) => {},
// 鼠标移入行
onMouseleave: (event) => {}
};
}
function rowClassName(record,index){
return index === this.rowindex ? 'rowStyle' : ''
//rowStyle自定义类名
}
<style>
/deep/ .rowStyle{
background-color:red
}
ant design vue 设置table表格点击背景高亮
最新推荐文章于 2024-05-10 17:17:36 发布