jwyu před 2 roky
rodič
revize
f6e3a7bf83
1 změnil soubory, kde provedl 8 přidání a 1 odebrání
  1. 8 1
      src/router/index.js

+ 8 - 1
src/router/index.js

@@ -377,7 +377,14 @@ const routes=[
 
 const router=createRouter({
   history:createWebHistory(import.meta.env.VITE_APP_BASE_URL),
-  routes
+  routes,
+  scrollBehavior(to, from, savedPosition){
+    if (savedPosition) {
+      return savedPosition
+    } else {
+      return { top: 0 }
+    }
+  }
 })
 
 router.beforeEach((to, from, next) => {