index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { createRouter, createWebHashHistory } from 'vue-router'
  2. import HomeView from '../views/main.vue'
  3. import iframeView from '@/views/iframeRoute.vue'
  4. import login from '@/views/login.vue'
  5. const router = createRouter({
  6. history: createWebHashHistory(import.meta.env.BASE_URL),
  7. routes: [
  8. {
  9. path: '/',
  10. name: 'home',
  11. component: HomeView
  12. },
  13. {
  14. path: '/login',
  15. name: 'login',
  16. component: login
  17. },
  18. {
  19. path: '/details/:title',
  20. name: 'Details',
  21. component: () => import('../views/Details.vue')
  22. },
  23. {
  24. path: '/admin',
  25. name: 'admin',
  26. // route level code-splitting
  27. // this generates a separate chunk (About.[hash].js) for this route
  28. // which is lazy-loaded when the route is visited.
  29. component: () => import('../views/admin.vue')
  30. },
  31. {
  32. path: '/course',
  33. name: 'course',
  34. component: () => import('../views/coursepage.vue')
  35. },
  36. {
  37. path: "/iframe/:title/:id",
  38. name: "iframe",
  39. meta: { title: "动态路由" },
  40. component: iframeView
  41. }
  42. ]
  43. })
  44. export default router