Код: Выделить всё
const router = createRouter({
history: createWebHistory(),
routes: [
// My routes here
],
scrollBehavior(to, from, savedPosition) {
// This is the part that doesn't seem to have any effect.
// I want to always scroll to the top on new navigation.
if (savedPosition) {
return savedPosition;
} else {
return { top: 0 };
}
},
});
Подробнее здесь: https://stackoverflow.com/questions/797 ... r-and-vite
Мобильная версия