Skip to content

Commit 6d63a7a

Browse files
committed
chore: more clear scroll event frozen
1 parent 5918ca9 commit 6d63a7a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/@vuepress/plugin-active-header-links/mixin.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ function getAnchors () {
4444
let freezeScrollEvent = false
4545

4646
export default {
47-
watch: {
48-
'$route.path' () {
49-
console.log('$route.path changed')
50-
freezeScrollEvent = true
51-
}
52-
},
53-
5447
mounted () {
48+
this.$router.beforeEach((to, from, next) => {
49+
if (to.path !== from.path) {
50+
freezeScrollEvent = true
51+
}
52+
next()
53+
})
54+
5555
this.$vuepress.$on('AsyncMarkdownContentMounted', (slotKey) => {
5656
freezeScrollEvent = false
5757
if (slotKey === 'default') {

0 commit comments

Comments
 (0)