mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
fix(vue-app): scroll to top on route changes only (#8557)
This commit is contained in:
parent
e9650c744f
commit
ac762299a1
@ -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 }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user