fix(cli): fix anchor
This commit is contained in:
@@ -88,9 +88,11 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (this.$route.hash) {
|
||||
scrollToAnchor(this.$route.hash);
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (this.$route.query.anchor) {
|
||||
scrollToAnchor(this.$route.query.anchor);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
@@ -2,7 +2,7 @@ export function scrollToAnchor(selector) {
|
||||
let count = 0;
|
||||
|
||||
const timer = setInterval(() => {
|
||||
const el = document.querySelector(selector);
|
||||
const el = document.querySelector('#' + selector);
|
||||
if (el) {
|
||||
el.scrollIntoView();
|
||||
clearInterval(timer);
|
||||
|
||||
Reference in New Issue
Block a user