index.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import { createRouter, createWebHashHistory } from 'vue-router'
  2. import HomeView from '../views/HomeView.vue'
  3. import MoreContent from '../views/MoreContent.vue'
  4. import PoemList from '../views/PoemList.vue'
  5. import PaintingList from '../views/PaintingList.vue'
  6. import PaintingDetailList from '../views/PaintingDetailList.vue'
  7. import GameView from '../views/GameView.vue'
  8. import BambooBookView from '../views/BambooBookView.vue'
  9. import BambooHotView from '../views/BambooHotView.vue'
  10. import ShuanggouDetail from '../views/ShuangGouSheSeDetail.vue'
  11. import ShuanggouPaintingDetail from '../views/ShuanggouPaintingDetail.vue'
  12. // import store from '@/store/index.js'
  13. const routes = [
  14. // {
  15. // path: '/',
  16. // redirect: '/home',
  17. // },
  18. {
  19. path: '/',
  20. name: 'HomeView',
  21. component: HomeView,
  22. },
  23. {
  24. path: '/more-content',
  25. name: 'MoreContent',
  26. component: MoreContent,
  27. },
  28. {
  29. path: '/poem-list',
  30. name: 'PoemList',
  31. component: PoemList,
  32. },
  33. {
  34. path: '/painting-list',
  35. name: 'PaintingList',
  36. component: PaintingList,
  37. },
  38. {
  39. path: '/painting-detail-list',
  40. name: 'PaintingDetailList',
  41. component: PaintingDetailList,
  42. },
  43. // 游戏
  44. {
  45. path: '/game',
  46. name: 'Game',
  47. component: GameView,
  48. },
  49. // 竹谱
  50. {
  51. path: '/bambooBook',
  52. name: 'BambooBook',
  53. component: BambooBookView,
  54. },
  55. // 竹子
  56. {
  57. path: '/bambooHot',
  58. name: 'BambooHot',
  59. component: BambooHotView,
  60. },
  61. // 双钩设色
  62. {
  63. path: '/shuanggouDetail',
  64. name: 'ShuanggouDetail',
  65. component: ShuanggouDetail
  66. },
  67. // 双沟设色-画作
  68. {
  69. path: '/shuanggou-painting-detail',
  70. name: 'ShuanggouPaintingDetail',
  71. component: ShuanggouPaintingDetail,
  72. },
  73. ]
  74. const router = createRouter({
  75. history: createWebHashHistory(),
  76. routes
  77. })
  78. router.beforeEach((to, from) => {
  79. // 生产环境下强制每次都从首页进入
  80. if (process.env.NODE_ENV === 'production' && !from.name && to.name !== 'HomeView') {
  81. return '/'
  82. }
  83. })
  84. export default router