index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. import { route } from 'quasar/wrappers'
  2. import { createRouter, createMemoryHistory, createWebHistory, createWebHashHistory } from 'vue-router'
  3. import routes from './routes'
  4. /*
  5. * If not building with SSR mode, you can
  6. * directly export the Router instantiation;
  7. *
  8. * The function below can be async too; either use
  9. * async/await or return a Promise which resolves
  10. * with the Router instance.
  11. */
  12. export default route(function (/* { store, ssrContext } */) {
  13. const createHistory = process.env.SERVER
  14. ? createMemoryHistory
  15. : (process.env.VUE_ROUTER_MODE === 'history' ? createWebHistory : createWebHashHistory)
  16. const Router = createRouter({
  17. scrollBehavior: () => ({ left: 0, top: 0 }),
  18. routes,
  19. // Leave this as is and make changes in quasar.conf.js instead!
  20. // quasar.conf.js -> build -> vueRouterMode
  21. // quasar.conf.js -> build -> publicPath
  22. // eslint-disable-next-line no-void
  23. // history: createHistory(process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE)
  24. history: createHistory(process.env.VUE_ROUTER_BASE)
  25. })
  26. return Router
  27. })