|
@@ -83,7 +83,11 @@ const routes = [
|
|
|
|
|
|
|
|
const router = createRouter({
|
|
const router = createRouter({
|
|
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
|
- routes
|
|
|
|
|
|
|
+ routes,
|
|
|
|
|
+ // 添加scrollBehavior配置项,实现页面切换时滚轴置顶
|
|
|
|
|
+ scrollBehavior() {
|
|
|
|
|
+ return { top: 0 }
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
// 全局路由守卫
|
|
// 全局路由守卫
|
|
|
router.beforeEach((to, from, next) => {
|
|
router.beforeEach((to, from, next) => {
|