Skip to content

Commit 8de8f3e

Browse files
committed
🔥 remove smooth-scroll logic
1 parent a7b3e22 commit 8de8f3e

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed
Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,13 @@
1-
import SmoothScroll from 'smooth-scroll/dist/smooth-scroll.js'
2-
31
export default {
42
created () {
53
this.$vuepress.$on('AsyncMarkdownContentMounted', () => {
64
this.$vuepress.$set('contentMounted', true)
7-
8-
this.$smoothScroll = new SmoothScroll('a[href*="#"]', {
9-
speed: 1,
10-
speedAsDuration: true,
11-
easing: 'easeInOutCubic'
12-
})
13-
14-
if (this.$route.hash) {
15-
const hash = decodeURIComponent(this.$route.hash)
16-
try {
17-
const anchor = document.getElementById(hash.slice(1))
18-
const anchorLink = anchor.querySelector('a.header-anchor')
19-
setTimeout(() => {
20-
window.scroll({
21-
top: anchorLink.offsetTop - 70,
22-
left: 0,
23-
behavior: 'auto'
24-
})
25-
})
26-
} catch (e) {
27-
console.error(e)
28-
}
29-
}
305
})
316
},
327

338
watch: {
349
'$route.path' () {
3510
this.$vuepress.$set('contentMounted', false)
36-
this.$smoothScroll.destroy()
3711
}
38-
},
39-
40-
beforeDestroy () {
41-
this.$smoothScroll.destroy()
4212
}
4313
}

0 commit comments

Comments
 (0)