diff --git a/blog/src/router/index.js b/blog/src/router/index.js index e94944b..7ceaccc 100644 --- a/blog/src/router/index.js +++ b/blog/src/router/index.js @@ -32,4 +32,8 @@ const router = createRouter({ routes }) +router.afterEach(() => { + window.scrollTo(0, 0) // 切换路由之后滚动条始终在最顶部 +}) + export default router