mirror of
https://gitcode.com/gh_mirrors/vue/vue-vben-admin
synced 2026-09-09 04:28:40 +00:00
@@ -101,11 +101,10 @@ function createScrollGuard(router: Router) {
|
|||||||
return /^#/.test(href);
|
return /^#/.test(href);
|
||||||
};
|
};
|
||||||
|
|
||||||
const body = document.body;
|
|
||||||
|
|
||||||
router.afterEach(async (to) => {
|
router.afterEach(async (to) => {
|
||||||
// scroll top
|
// scroll top
|
||||||
isHash((to as RouteLocationNormalized & { href: string })?.href) && body.scrollTo(0, 0);
|
isHash((to as RouteLocationNormalized & { href: string })?.href) &&
|
||||||
|
document.querySelector('.vben-layout-content')?.scrollTo(0, 0);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user