index.js 945 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { createRouter, createWebHashHistory } from 'vue-router'
  2. import HomeView from '../views/Home.vue'
  3. import UnitList from '../views/UnitList.vue'
  4. import RelicList from '../views/RelicList.vue'
  5. import RelicDetail from '../views/RelicDetail.vue'
  6. // import store from '@/store/index.js'
  7. const routes = [
  8. {
  9. path: '/',
  10. name: 'HomeView',
  11. component: HomeView,
  12. },
  13. {
  14. path: '/unit-list',
  15. name: 'UnitList',
  16. component: UnitList,
  17. },
  18. {
  19. path: '/relic-list',
  20. name: 'RelicList',
  21. component: RelicList,
  22. },
  23. {
  24. path: '/relic-detail',
  25. name: 'RelicDetail',
  26. component: RelicDetail,
  27. },
  28. ]
  29. const router = createRouter({
  30. history: createWebHashHistory(),
  31. routes,
  32. })
  33. // router.beforeEach((to, from) => {
  34. // // 生产环境下强制每次都从首页进入
  35. // if (process.env.NODE_ENV === 'production' && !from.name && to.name !== 'HomeView') {
  36. // return '/'
  37. // }
  38. // })
  39. export default router