123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- import { createRouter, createWebHistory } from 'vue-router'
- import { defineAsyncComponent } from 'vue'
- // import Home from '@/views/Home.vue'
- // import HomeView from '@/views/HomeView.vue'
- //路由异步加载
- //主页框架
- const Home = () => import('@/views/Home.vue')
- //首页详细内容
- const HomeView = () => import('@/views/HomeView.vue')
- //科普内容
- const PopularizationScience = () => import('@/views/PopularizationScience.vue')
- const Community = () => import('@/views/Community.vue')
- // 组件异步懒加载方法
- // const _import = (path: string) =>
- // defineAsyncComponent(() => import(`../views/${path}.vue`))
- const routes = [
- {
- path: '/',
- name: 'home',
- // component: Home,
- component: Home,
- redirect: "/homeView",
- children: [{
- path: 'homeView',
- name: 'homeView',
- component: HomeView
- // component: _import('HomeView')
- },
- {
- path: 'popularizationScience',
- name: 'popularizationScience',
- component: PopularizationScience
- },
- {
- path: 'community',
- name: 'community',
- component: () => import('@/views/Community.vue')
- }, {
- path: 'plan',
- name: 'plan',
- component: () => import('@/views/Plan.vue')
- }, {
- path: 'testRecord',
- name: 'testRecord',
- component: () => import('@/views/TestRecord.vue')
- }, {
- path: 'report/:id',
- name: 'report',
- component: () => import('@/views/Report.vue')
- },
- {
- path: 'login',
- name: 'login',
- component: () => import('@/views/Login.vue')
- },
- {
- path: 'register',
- name: 'register',
- component: () => import('@/views/Register.vue')
- },
- {
- path: 'scale/:planId/:planName/:flag/:flagName/:num',
- name: 'scale',
- component: () => import('@/views/Scale.vue')
- },
- {
- path: 'scaleMid',
- name: 'scaleMid',
- component: () => import('@/views/ScaleMid.vue')//量表中间件
- },
- //认知任务
- {
- path: 'cognize/:planId/:planName/:flag/:flagName/:num',
- name: 'cognize',
- component: () => import('@/views/Cognize.vue')
- }
- ]
- // component: HomeView
- },
- {
- path: '/cognizeGoNoGo/:currentType/:planId/:planName/:flag/:flagName/:num',
- name: 'cognizeGoNoGo',
- component: () => import('@/views/CognizeGoNoGo.vue')
- }, {
- path: '/cognizeFaceDot/:currentType/:planId/:planName/:flag/:flagName/:num',
- name: 'cognizeFaceDot',
- component: () => import('@/views/CognizeFaceDot.vue')
- }
- ]
- const router = createRouter({
- history: createWebHistory(import.meta.env.BASE_URL),
- routes
- })
- export default router
|