fix
This commit is contained in:
@@ -1,49 +1,62 @@
|
||||
import { createRouter, createWebHistory, RouteRecordRaw, createWebHashHistory } from 'vue-router'
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
const _import = (path : string) => defineAsyncComponent(() => import(`../views/${path}.vue`));
|
||||
const _import = (path: string) => defineAsyncComponent(() => import(`../views/${path}.vue`));
|
||||
|
||||
const routes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: "/",
|
||||
// redirect重定向
|
||||
redirect: "/login"
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: _import('LoginPage')
|
||||
},
|
||||
{
|
||||
path: '/home',
|
||||
name: 'home',
|
||||
component: _import('HomeView')
|
||||
},
|
||||
{
|
||||
path: '/demo',
|
||||
name: 'demo',
|
||||
component: _import('Demo')
|
||||
},
|
||||
{
|
||||
path: '/history',
|
||||
name: 'history',
|
||||
component: _import('HistoryPage')
|
||||
},
|
||||
{
|
||||
path: '/library',
|
||||
name: 'library',
|
||||
component: _import('LibraryPage')
|
||||
},
|
||||
{
|
||||
path: '/trialApproval',
|
||||
name: 'trialApproval',
|
||||
component: _import('trialApproval')
|
||||
},
|
||||
{
|
||||
path: "/",
|
||||
// redirect重定向
|
||||
redirect: "/login"
|
||||
// redirect: "/Upgrade"
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: _import('LoginPage')
|
||||
},
|
||||
{
|
||||
path: '/upgrade',
|
||||
name: 'upgrade',
|
||||
component: _import('Upgrade'),
|
||||
},
|
||||
{
|
||||
path: '/home',
|
||||
name: 'home',
|
||||
component: _import('HomeView')
|
||||
},
|
||||
{
|
||||
path: '/demo',
|
||||
name: 'demo',
|
||||
component: _import('Demo')
|
||||
},
|
||||
{
|
||||
path: '/history',
|
||||
name: 'history',
|
||||
component: _import('HistoryPage')
|
||||
},
|
||||
{
|
||||
path: '/library',
|
||||
name: 'library',
|
||||
component: _import('LibraryPage')
|
||||
},
|
||||
{
|
||||
path: '/trialApproval',
|
||||
name: 'trialApproval',
|
||||
component: _import('trialApproval')
|
||||
},
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(process.env.BASE_URL),
|
||||
// history: createWebHashHistory(),
|
||||
routes
|
||||
history: createWebHistory(process.env.BASE_URL),
|
||||
// history: createWebHashHistory(),
|
||||
routes
|
||||
})
|
||||
|
||||
// router.beforeEach((to, from, next) => {
|
||||
// const toName = to.name === 'upgrade';
|
||||
// if (toName) {
|
||||
// next();
|
||||
// } else {
|
||||
// next({ name: 'upgrade' });
|
||||
// }
|
||||
// });
|
||||
export default router
|
||||
|
||||
Reference in New Issue
Block a user