import { createRouter, createWebHashHistory } from 'vue-router' import HomeView from '../views/HomeView.vue' import NotFoundView from '../views/NotFoundView.vue' const router = createRouter({ history: createWebHashHistory(import.meta.env.BASE_URL), routes: [ { path: '/', name: 'home', component: HomeView, }, { path: '/about', name: 'about', // route level code-splitting // this generates a separate chunk (About.[hash].js) for this route // which is lazy-loaded when the route is visited. component: () => import('../views/AboutView.vue'), }, { path: '/news', name: 'news', component: () => import('../views/NewsView.vue'), }, { path: '/introduction', name: 'introduction', component: () => import('../views/IntrodView.vue'), }, { path: '/communicate', name: 'communicate', component: () => import('../views/CommunicateView.vue'), }, { path: '/research', name: 'research', component: () => import('../views/ResearchView.vue'), }, { path: '/fusion', name: 'fusion', component: () => import('../views/FusionView.vue'), }, { path: '/inheritor', name: 'inheritor', component: () => import('../views/InheritorView.vue'), }, { path: '/404', name: 'NotFound', component: NotFoundView }, { path: '/:pathMatch(.*)*', // 匹配所有不存在的路径 redirect: '/404' } ], }) export default router