element ui table 用render函数排序高亮样式不显示
时间: 2023-12-22 18:02:25 浏览: 154
你好,对于 Element UI Table 中使用 Render 函数排序时,高亮样式不显示的问题,可以尝试以下几个解决方法:
1. 在 Render 函数中给需要高亮的元素添加一个 class 名称,并在 CSS 样式中设置该 class 的样式即可实现高亮效果。
2. 在 Table 组件中设置 highlight-current-row 属性为 true,即可在当前行添加高亮样式。
3. 在 Render 函数中手动判断当前行是否为当前选中行,若是则添加高亮样式,例如:
```
render: (h, { row, column, index }) => {
const className = index === this.currentIndex ? 'current-row' : '';
return h('div', { class: className }, row[column.property]);
}
```
其中,this.currentIndex 为当前选中行的索引。
希望以上方法能够帮助到你。
阅读全文