在自定义Element的时候,有一些自带特效我们不想要,去掉又不知道怎么去掉。
比如Table的hover变色。
其实方法并不是去掉,而是让他看起来不变。
开始↓定义单元格背景色:
<el-table
:cell-style="{background:'#f5f5f5'}"
>
定义单元格hover颜色:
.el-table tbody tr:hover>td {
background-color:#f5f5f5 !important
}
其实就是让hover颜色跟背景色一样啊
用函数方法
:cell-style="setCellStyle"
函数方法为
setCellStyle({ row, column, rowIndex, columnIndex }) {
if (column.label === '当前列表头的名字') {
return "background:#e8e8e8;"//可以设置颜色或者边框
}
if (columnIndex === 4) {
return "background:#e8e8e8;"
} else {
return "background:#e8e8e8;"
}
}
————————————————————————————