Browse Source

路由跳转新页面后回到新页面顶部

reghao 3 năm trước cách đây
mục cha
commit
3976fb76f6
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      src/router/index.js

+ 4 - 0
src/router/index.js

@@ -446,4 +446,8 @@ router.beforeEach((to, from, next) => {
   }
 })
 
+router.afterEach((to, from, next) => {
+  window.scrollTo(0, 0)
+})
+
 export default router