Add scrollToTop option

This commit is contained in:
Sébastien Chopin 2016-12-27 14:53:14 +01:00
parent cb4dcf0b37
commit f82bde9d1c

View File

@ -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 }