router.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
  2. import Home from "./view-detail";
  3. import Notfind from "../view/notfind";
  4. const routes: RouteRecordRaw[] = [
  5. {
  6. path: "/",
  7. component: Home,
  8. },
  9. {
  10. path: "/product-img",
  11. component: () => import("/src/view/transfer-to-img/index"),
  12. },
  13. {
  14. path: "/evaluat-report",
  15. component: () => import("./view-evaluat-report/index"),
  16. },
  17. {
  18. path: "/preview",
  19. component: () => import("./view-preview/index"),
  20. },
  21. {
  22. path: "/view-figner",
  23. component: () => import("./view-figner/index"),
  24. },
  25. {
  26. path: "/simple-detail", // 简单的一行谱页面
  27. component: () => import("./simple-detail/index"),
  28. },
  29. {
  30. path: "/:pathMatch(.*)*",
  31. component: Notfind,
  32. meta: {
  33. title: "404 Not Fund",
  34. },
  35. },
  36. ];
  37. const router = createRouter({
  38. history: createWebHashHistory(),
  39. routes,
  40. });
  41. router.beforeEach((to, from, next) => {
  42. if (to.meta.title) {
  43. document.title = to.meta.title as string;
  44. }
  45. next();
  46. });
  47. export default router;