Parcourir la source

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

reghao il y a 3 ans
Parent
commit
3976fb76f6
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  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