xachary
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
3 deletions
-
src/router/guard/index.ts
|
|
|
@ -101,11 +101,10 @@ function createScrollGuard(router: Router) { |
|
|
|
return /^#/.test(href); |
|
|
|
}; |
|
|
|
|
|
|
|
const body = document.body; |
|
|
|
|
|
|
|
router.afterEach(async (to) => { |
|
|
|
// 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; |
|
|
|
}); |
|
|
|
} |
|
|
|
|