feat:vue-element-admin升级改造vue3
This commit is contained in:
@@ -1,13 +1,35 @@
|
||||
import {createRouter, createWebHashHistory, RouteRecordRaw} from 'vue-router'
|
||||
import Layout from '@/layout/index.vue'
|
||||
|
||||
const routes: Array<RouteRecordRaw> = [
|
||||
export const constantRoutes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: '/redirect',
|
||||
component: Layout,
|
||||
meta: {hidden: true},
|
||||
children: [
|
||||
{
|
||||
path: '/redirect/:path(.*)',
|
||||
component: () => import('@/views/redirect/index.vue')
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: () => import('@views/login/index.vue'),
|
||||
component: () => import('@/views/login/index.vue'),
|
||||
meta: {title: '登录'}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
path: '/404',
|
||||
component: () => import('@/views/error-page/404.vue'),
|
||||
meta: {hidden: true}
|
||||
},
|
||||
{
|
||||
path: '/401',
|
||||
component: () => import('@/views/error-page/401.vue'),
|
||||
meta: {hidden: true}
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
redirect: '/dashboard',
|
||||
@@ -22,9 +44,15 @@ const routes: Array<RouteRecordRaw> = [
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes: routes
|
||||
routes: constantRoutes
|
||||
})
|
||||
|
||||
export function resetRouter() {
|
||||
const newRouter = router;
|
||||
(router as any).matcher = (newRouter as any).matcher
|
||||
}
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user