优化渲染顺序

This commit is contained in:
aixianling
2024-10-23 10:42:53 +08:00
parent 88b22acf20
commit e6253c9ac8

View File

@@ -146,12 +146,13 @@ Vue.component("scrollTable", {
}, },
methods: { methods: {
initScroll() { initScroll() {
const {SimpleBar} = window const {SimpleBar, $waitFor} = window
const dom = this.$el.querySelector('.el-table__body-wrapper') $waitFor(this.$el.querySelector('.el-table__body-wrapper')).then(dom => {
this.scroll = new SimpleBar(dom) this.scroll = new SimpleBar(dom)
dom.addEventListener('mouseover', this.stopAutoScroll) dom.addEventListener('mouseover', this.stopAutoScroll)
// dom.addEventListener('mouseout', this.autoScroll) // dom.addEventListener('mouseout', this.autoScroll)
// this.scroll.refresh(); // this.scroll.refresh();
})
}, },
autoScroll() { autoScroll() {
if (this.timer) clearInterval(this.timer) if (this.timer) clearInterval(this.timer)
@@ -165,7 +166,8 @@ Vue.component("scrollTable", {
}, 60) }, 60)
}, },
stopAutoScroll() { stopAutoScroll() {
this.$el.querySelector('.simplebar-vertical').style.display = 'block' const {$waitFor} = window
$waitFor(this.$el.querySelector('.simplebar-vertical')).then(dom => dom.style.display = 'block')
if (this.timer) clearInterval(this.timer) if (this.timer) clearInterval(this.timer)
} }
}, },