import { createRouter, createWebHashHistory } from 'vue-router' import HomeView from '../views/HomeView.vue' import MoreContent from '../views/MoreContent.vue' import PoemList from '../views/PoemList.vue' import PaintingList from '../views/PaintingList.vue' import PaintingDetailList from '../views/PaintingDetailList.vue' import GameView from '../views/GameView.vue' import BambooBookView from '../views/BambooBookView.vue' // import store from '@/store/index.js' const routes = [ // { // path: '/', // redirect: '/home', // }, { path: '/', name: 'HomeView', component: HomeView, }, { path: '/more-content', name: 'MoreContent', component: MoreContent, }, { path: '/poem-list', name: 'PoemList', component: PoemList, }, { path: '/painting-list', name: 'PaintingList', component: PaintingList, }, { path: '/painting-detail-list', name: 'PaintingDetailList', component: PaintingDetailList, }, { path: '/game', name: 'Game', component: GameView, }, // 竹谱 { path: '/bambooBook', name: 'BambooBook', component: BambooBookView, }, ] const router = createRouter({ history: createWebHashHistory(), routes }) router.beforeEach((to, from) => { // 生产环境下强制每次都从首页进入 if (process.env.NODE_ENV === 'production' && !from.name && to.name !== 'HomeView') { return '/' } }) export default router