Explorar o código

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

reghao %!s(int64=3) %!d(string=hai) anos
pai
achega
3976fb76f6
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  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