Skip to content

Commit d0bcc22

Browse files
author
shimh-develop
committed
切换路由滚动到顶部
1 parent be5743f commit d0bcc22

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

blog-app/src/router/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ const router = new Router({
6868
requireLogin: true
6969
},
7070
}
71-
]
71+
],
72+
scrollBehavior (to, from, savedPosition) {
73+
return { x: 0, y: 0 }
74+
}
7275
})
7376

7477
router.beforeEach((to, from, next) => {

0 commit comments

Comments
 (0)