fix(vue-app): scroll to top on route changes only (#8557)

This commit is contained in:
Beorn Facchini 2020-12-27 06:19:33 +11:00 committed by GitHub
parent e9650c744f
commit ac762299a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,9 +31,11 @@ export default function (to, from, savedPosition) {
// Scroll to the top of the page if... // Scroll to the top of the page if...
if ( if (
// One of the children set `scrollToTop` // One of the children set `scrollToTop`
Pages.some(Page => Page.options.scrollToTop) || (Pages.some(Page => Page.options.scrollToTop) ||
// scrollToTop set in only page without children // scrollToTop set in only page without children
(Pages.length < 2 && Pages.every(Page => Page.options.scrollToTop !== false)) (Pages.length < 2 && Pages.every(Page => Page.options.scrollToTop !== false))) &&
// route changes
to !== from
) { ) {
position = { x: 0, y: 0 } position = { x: 0, y: 0 }
} }