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) => { const scrollBehavior = (to, from, savedPosition) => {
// savedPosition is only available for popstate navigations.
if (savedPosition) { if (savedPosition) {
// savedPosition is only available for popstate navigations.
return savedPosition return savedPosition
} else { } else {
let position = {} let position = {}
// if no children detected // if no children detected
if (to.matched.length < 2) { if (to.matched.length < 2) {
// scroll to the top of the page
position = { x: 0, y: 0 } position = { x: 0, y: 0 }
} }
else if (to.matched.some((r) => r.components.default.options.scrollToTop)) { 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 } position = { x: 0, y: 0 }
} }
// if link has anchor, scroll to anchor by returning the selector // if link has anchor, scroll to anchor by returning the selector