diff --git a/packages/vant-cli/site/desktop/main.js b/packages/vant-cli/site/desktop/main.js index f43901a2e..5de1e86c1 100644 --- a/packages/vant-cli/site/desktop/main.js +++ b/packages/vant-cli/site/desktop/main.js @@ -31,6 +31,19 @@ window.vueRouter = router; new Vue({ el: '#app', + mounted() { + if (this.$route.hash) { + // wait page init + setTimeout(() => { + const el = document.querySelector(this.$route.hash); + if (el) { + el.scrollIntoView({ + behavior: 'smooth' + }); + } + }, 1000); + } + }, render: h => h(App), router });