index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { createRouter, createWebHistory } from "vue-router";
  2. const routes=[
  3. {
  4. path: "/",
  5. name: "Layout",
  6. redirect:'/update/index',
  7. component: ()=>import("@/layouts/Index.vue"),
  8. children:[
  9. {
  10. path:"/help/index",
  11. name:"HelpIndex",
  12. component: () => import("@/views/help/Index.vue"),
  13. meta: {
  14. title: "帮助中心",
  15. },
  16. },
  17. {
  18. path:"/update/index",
  19. name:"UpdateIndex",
  20. component: () => import("@/views/update/Index.vue"),
  21. meta: {
  22. title: "ETA投研系统更新日志",
  23. },
  24. },
  25. ]
  26. },
  27. {
  28. path: "/:pathMatch(.*)",
  29. name: "error",
  30. component: () => import("@/views/404.vue"),
  31. meta: { title: "404" },
  32. },
  33. ]
  34. const router = createRouter({
  35. history: createWebHistory(import.meta.env.VITE_APP_BASE_URL),
  36. routes,
  37. });
  38. router.beforeEach((to, from, next) => {
  39. document.title = to.meta.title;
  40. next();
  41. });
  42. export default router;