Skip to content

Commit d4c117f

Browse files
committed
Auto scrollTo hash
1 parent c0d5c65 commit d4c117f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/views/Document.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@
5555
<script>
5656
import marked from 'marked'
5757
export default {
58+
59+
mounted() {
60+
// auto screenTop hash
61+
if (this.$route.hash) {
62+
let el = document.querySelector(this.$route.hash)
63+
if (el) {
64+
window.scrollTo(0, el.offsetTop)
65+
}
66+
}
67+
},
68+
5869
computed: {
5970
document() {
6071
return require('../docs/' + this.$i18n.locale)

0 commit comments

Comments
 (0)