mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
Add scrollToTop option
This commit is contained in:
parent
cb4dcf0b37
commit
f82bde9d1c
@ -35,6 +35,9 @@ const scrollBehavior = (to, from, savedPosition) => {
|
||||
if (to.matched.length < 2) {
|
||||
position = { x: 0, y: 0 }
|
||||
}
|
||||
else if (to.matched.some((r) => r.components.default.scrollToTop || (r.components.default.options && r.components.default.options.scrollToTop))) {
|
||||
position = { x: 0, y: 0 }
|
||||
}
|
||||
// if link has anchor, scroll to anchor by returning the selector
|
||||
if (to.hash) {
|
||||
position = { selector: to.hash }
|
||||
|
Loading…
Reference in New Issue
Block a user