Skip to content

Commit 24fe6f4

Browse files
souljorjetangbc
authored andcommitted
PageMode: toggle onScroll on activated/deactivated
Fix unexpected behaviour i.e. with tabs.
1 parent 83ee782 commit 24fe6f4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/index.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,21 @@ const VirtualList = Vue.component('virtual-list', {
6060
}
6161
},
6262

63-
// set back offset when awake from keep-alive
6463
activated () {
64+
// set back offset when awake from keep-alive
6565
this.scrollToOffset(this.virtual.offset)
66+
67+
if (this.pageMode) {
68+
document.addEventListener('scroll', this.onScroll, {
69+
passive: false,
70+
})
71+
}
72+
},
73+
74+
deactivated() {
75+
if (this.pageMode) {
76+
document.removeEventListener('scroll', this.onScroll)
77+
}
6678
},
6779

6880
mounted () {

0 commit comments

Comments
 (0)