Przeglądaj źródła

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

reghao 3 lat temu
rodzic
commit
3976fb76f6
1 zmienionych plików z 4 dodań i 0 usunięć
  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