/* * @Description: router * @Author: zenghua.wang * @Date: 2023-06-20 11:48:41 * @LastEditors: zenghua.wang * @LastEditTime: 2025-02-05 09:31:21 */ import { createRouter, createWebHistory } from 'vue-router'; import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper'; import Layout from '@/layouts/index.vue'; import resourceRouter from './modules/resource'; import plantingAndBreedingRouter from './modules/plantingAndBreeding'; const { VITE_APP_NAME } = import.meta.env; export const constantRoutes = [ { path: '/404', name: '404', component: () => import('@/views/error/404.vue'), hidden: true, }, { path: '/403', name: '403', component: () => import('@/views/error/403.vue'), hidden: true, }, { path: '/', name: 'layout', component: Layout, redirect: '/home', meta: { title: '政务服务', icon: 'House' }, children: [ { path: '/home', component: () => import('@/views/home/index.vue'), name: 'home', meta: { title: '政务服务主页', icon: 'House' }, }, ], }, // ...resourceRouter, ...plantingAndBreedingRouter, ]; /** * @Title notFoundRouter(找不到路由) */ export const notFoundRouter = { path: '/:pathMatch(.*)', name: 'notFound', redirect: '/404', }; const router = createRouter({ history: createWebHistory(qiankunWindow.__POWERED_BY_QIANKUN__ ? `/${VITE_APP_NAME}/` : '/'), // history routes: constantRoutes, }); export default router;