Improve comments

This commit is contained in:
Sébastien Chopin 2017-01-26 15:21:21 +01:00
parent f3719add05
commit 4cbd6d6a28

View File

@ -27,16 +27,18 @@ const <%= route._name %> = process.BROWSER_BUILD ? () => System.import('<%= rout
<% }) %>
const scrollBehavior = (to, from, savedPosition) => {
// savedPosition is only available for popstate navigations.
if (savedPosition) {
// savedPosition is only available for popstate navigations.
return savedPosition
} else {
let position = {}
// if no children detected
if (to.matched.length < 2) {
// scroll to the top of the page
position = { x: 0, y: 0 }
}
else if (to.matched.some((r) => r.components.default.options.scrollToTop)) {
// if one of the children has scrollToTop option set to true
position = { x: 0, y: 0 }
}
// if link has anchor, scroll to anchor by returning the selector