mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxt): scroll to top in nested routes (#21657)
This commit is contained in:
parent
de639e7ef9
commit
91ebcd7ee9
@ -57,12 +57,13 @@ function _getHashElementScrollMarginTop (selector: string): number {
|
||||
return 0
|
||||
}
|
||||
|
||||
function _isDifferentRoute (a: RouteLocationNormalized, b: RouteLocationNormalized): boolean {
|
||||
const samePageComponent = a.matched[0] === b.matched[0]
|
||||
function _isDifferentRoute (from: RouteLocationNormalized, to: RouteLocationNormalized): boolean {
|
||||
const samePageComponent = to.matched.every((comp, index) => comp.components?.default === from.matched[index]?.components?.default)
|
||||
|
||||
if (!samePageComponent) {
|
||||
return true
|
||||
}
|
||||
if (samePageComponent && JSON.stringify(a.params) !== JSON.stringify(b.params)) {
|
||||
if (samePageComponent && JSON.stringify(from.params) !== JSON.stringify(to.params)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user