说明:
1、type="selection"选中事件
2、@cell-mouse-enter鼠标移到列表触发事件
问题:执行@cell-mouse-enter的时候会直接取消type="selection"选中事件。
解决方法:
cellMouseEnter(row, column, cell, event) {
let Arr = JSON.parse(JSON.stringify(this.listData));
for (let index = 0; index < Arr.length; index++) {
const element = Arr[index];
// 匹配滑过的当前行
if (element.id === row.id) {
element["hoverFlag1"] = true;
} else {
element["hoverFlag1"] = false;
}
}
this.listData = JSON.parse(JSON.stringify(Arr));
let rows = [];
//获取选中数据dataonLineListSelections
if (this.dataonLineListSelections.length > 0) {
for (let i = 0; i < this.listData.length; i++) {
if (this.listData[i].id == this.dataonLineListSelections[0].id) {
rows.push(this.listData[i]);
this.$nextTick(() => {
rows.forEach(row => {
//重新定义type="selection"
this.$refs.table.toggleRowSelection(row);
});
});
}
}
}
}
以上是编程学习网小编为您介绍的“el-table解决@cell-mouse-enter和type="selection"同时存在bug”的全面内容,想了解更多关于 vuejs 内容,请继续关注编程基础学习网。
织梦狗教程
本文标题为:el-table解决@cell-mouse-enter和type="selection"同时存在bug


基础教程推荐
猜你喜欢
- js设置cookie过期及清除浏览器对应名称的cookie 2024-01-29
- 详解javascript获取url信息的常见方法 2024-01-07
- python+selenium 定位到元素,无法点击的解决方法 2024-02-05
- Select2在使用ajax获取远程数据时显示默认数据的方法 2023-02-22
- JS实现把一个页面层数据传递到另一个页面的两种方式 2024-03-09
- CSS中px em rem区别与使用 2023-12-12
- TWebBrowser 与 MSHTML(4): location、history、screen、navigator 对象的属性与方法纵览 2023-10-26
- Ajax简单的异步交互及Ajax原生编写 2022-12-18
- jQuery中内容过滤器简单用法示例 2024-03-10
- vue如何实现页面禁止返回(禁止返回上一页) 2025-01-14