diff --git a/docs/.vuepress/enhanceApp.js b/docs/.vuepress/enhanceApp.js new file mode 100644 index 000000000..5a3de40b2 --- /dev/null +++ b/docs/.vuepress/enhanceApp.js @@ -0,0 +1,18 @@ +export default ({ router }) => { + if(typeof process === 'undefined' || process.env.VUE_ENV !== 'server') { + router.onReady(() => { + const { app } = router; + + app.$once("hook:mounted", () => { + setTimeout(() => { + const { hash } = document.location; + if (hash.length > 1) { + const id = decodeURIComponent(hash.substring(1)); + const element = document.getElementById(id); + if (element) element.scrollIntoView(); + } + }, 500); + }); + }); + } +}