VUE + element-ui改变table表格中点选行的颜色

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_41127584/article/details/102566992
<el-table 
			:data="EnterpriseList.slice((currentPage-1)*pagesize,currentPage*pagesize)" 
			:header-cell-style="{background:'#eef1f6',color:'#606266'}"
			highlight-current-row
			@current-change="handleTableChange"
			>

@current-change="handleTableChange"
设置表格单选行的属性函数

//表格单选
			handleTableChange(val){
				this.currentRow = val;
				console.log(this.currentRow)
			},

获取当前单选行的全部数据

官网文档中颜色偏淡,标识性不强,我们可以在App.vue中更改一下CSS属性如下

<style>
	html,
	body {
	  margin: 0;
	  padding: 0;
	}
	.el-table__body tr.current-row>td{
		background-color: #BBBBBB;
	}
</style>

background-color根据自己业务需求更改即可
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_41127584/article/details/102566992