modify scroll behavior (always scrolltotop but on index page)

This commit is contained in:
lesion
2022-05-06 15:09:11 +02:00
parent 1ff5cdec99
commit 13e5427f3c

View File

@@ -0,0 +1,10 @@
/**
* https://nuxtjs.org/docs/configuration-glossary/configuration-router/#scrollbehavior
* always scrollToTop but on index page
*/
export default function (to, _from, savedPosition) {
if (to.name === 'index') {
return savedPosition
}
return { x: 0, y: 0 }
}