router.ts 519 B

123456789101112131415161718
  1. import {
  2. createMemoryHistory,
  3. createRouter as _createRouter,
  4. createWebHistory
  5. } from 'vue-router'
  6. export function createRouter() {
  7. return _createRouter({
  8. // use appropriate history implementation for server/client
  9. // import.meta.env.SSR is injected by Vite.
  10. history: import.meta.env.SSR ? createMemoryHistory() : createWebHistory(),
  11. routes: [{
  12. name: 'home',
  13. path: '/',
  14. component: () => import('./pages/index.vue')
  15. }]
  16. })
  17. }