modify scroll behavior (always scrolltotop but on index page)
This commit is contained in:
10
app/router.scrollBehavior.js
Normal file
10
app/router.scrollBehavior.js
Normal 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 }
|
||||
}
|
||||
Reference in New Issue
Block a user