Commit 70a758b3 by luyt

fix: 修复快速滚动下的高亮竖线错位问题

1 parent 16f24d37
This diff could not be displayed because it is too large.
...@@ -225,7 +225,8 @@ export default { ...@@ -225,7 +225,8 @@ export default {
showClass: false, showClass: false,
tableHeightValues: null, tableHeightValues: null,
bAntiShike: false, //防抖 bAntiShike: false, //防抖
componentKey: Date.now() //用于更新组件 componentKey: Date.now(), //用于更新组件
hightCell:''
} }
}, },
...@@ -243,10 +244,18 @@ export default { ...@@ -243,10 +244,18 @@ export default {
}, },
methods: { methods: {
handleScroll() {
console.log(123)
requestAnimationFrame(()=>{
console.log(132456)
this.hoverFn('','',this.hightCell)
})
},
// 竖线高亮实现 // 竖线高亮实现
hoverFn(row, column, cell, event) { hoverFn(row, column, cell, event) {
// console.log('row, column, cell, event: ', cell.offsetHeight) // console.log('row, column, cell, event: ', cell.offsetHeight)
setTimeout(() => { requestAnimationFrame(() => {
this.hightCell = cell
const height = cell.offsetHeight const height = cell.offsetHeight
const offsetTop = cell.getBoundingClientRect().y const offsetTop = cell.getBoundingClientRect().y
if (!hignLigihtLine) { if (!hignLigihtLine) {
...@@ -402,10 +411,15 @@ export default { ...@@ -402,10 +411,15 @@ export default {
}, 300) }, 300)
} }
} }
//监听滚动事件
window.addEventListener("scroll", this.handleScroll, true);
}, },
beforeDestroy() { beforeDestroy() {
// 事件注销 // 事件注销
window.onresize = null window.onresize = null
//监听滚动事件
window.removeEventListener("scroll", this.handleScroll, true);
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!