diff --git a/middleware/route.global.js b/middleware/route.global.js new file mode 100644 index 000000000..d3a517024 --- /dev/null +++ b/middleware/route.global.js @@ -0,0 +1,9 @@ +export default defineNuxtRouteMiddleware((to, from) => { + useNuxtApp().hook('page:finish', () => { + if (history.state.scroll) { + setTimeout(() => window.scrollTo(history.state.scroll), 0); + } else { + setTimeout(() => window.scrollTo(0, 0), 0); + } + }); +}); diff --git a/pages/Intro.vue b/pages/Intro.vue new file mode 100644 index 000000000..034a78695 --- /dev/null +++ b/pages/Intro.vue @@ -0,0 +1,29 @@ + + + diff --git a/pages/index.vue b/pages/index.vue index 2c2a6d9e8..4120a5d05 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,10 +1,6 @@ diff --git a/plugins/scrollToTop.js b/plugins/scrollToTop.js deleted file mode 100644 index c69fdce68..000000000 --- a/plugins/scrollToTop.js +++ /dev/null @@ -1,9 +0,0 @@ -export default defineNuxtPlugin((nuxtApp) => { - nuxtApp.$router.options.scrollBehavior = () => { - return new Promise((resolve) => { - setTimeout(() => { - resolve({ left: 0, top: 0, behaviour: 'smooth' }); - }, 100); - }); - }; -});