This commit is contained in:
X1627315083
2024-01-05 14:12:03 +08:00
parent 6abd6816d9
commit 184b95239a
22 changed files with 267 additions and 55 deletions

View File

@@ -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