在进行路由跳转时,页面没有滚动到顶部的解决方案
route/index.js
const router = createRouter({
history: createWebHashHistory(),
routes,
// 每次切换路由页面滚动到顶部
scrollBehavior () {
return { top: 0 }
}
})
在进行路由跳转时,页面没有滚动到顶部的解决方案
route/index.js
const router = createRouter({
history: createWebHashHistory(),
routes,
// 每次切换路由页面滚动到顶部
scrollBehavior () {
return { top: 0 }
}
})