index.ts 770 B

12345678910111213141516171819202122232425262728293031
  1. import {createRouter, createWebHistory, type Router, type RouteRecordRaw} from 'vue-router'
  2. import HomeView from '../view/HomeView.vue'
  3. import AboutView from '../view/AboutView.vue'
  4. import CommonLayout from '../layout/CommonLayout.vue'
  5. const routes:RouteRecordRaw[] = [
  6. {
  7. path: '/',
  8. name: 'commonLayout',
  9. component: CommonLayout,
  10. children: [
  11. {
  12. path: '/',
  13. name: 'home',
  14. component: HomeView
  15. },
  16. {
  17. path: '/about',
  18. name: 'about',
  19. component: AboutView
  20. },
  21. ],
  22. },
  23. ]
  24. const router : Router = createRouter({
  25. history: createWebHistory(),
  26. routes: routes,
  27. });
  28. export default router