router.js
730 Bytes
/*
* @Date: 2024-08-26 10:42:15
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-09-30 16:23:36
* @FilePath: /hager/src/router.js
* @Description: 文件描述
*/
import Vue from 'vue'
import VueRouter from 'vue-router'
import ConfigRouter from './route.js'
Vue.use(VueRouter)
const router = new VueRouter({
// history: false,
// hashbang: true,
mode: 'history',
base: '/',
routes: ConfigRouter,
scrollBehavior(to, from, savedPosition) {
// 每次路由切换后,页面滚动到顶部
return { x: 0, y: 0 };
}
})
router.beforeEach((to, from, next) => {
next()
})
router.afterEach((to, from, next) => {
// store.commit('updateLoadingStatus', false)
})
export default router