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 BambooHotView from '../views/BambooHotView.vue' import ShuanggouDetail from '../views/ShuangGouSheSeDetail.vue' import ShuanggouPaintingDetail from '../views/ShuanggouPaintingDetail.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, }, // 竹子 { path: '/bambooHot', name: 'BambooHot', component: BambooHotView, }, // 双钩设色 { path: '/shuanggouDetail', name: 'ShuanggouDetail', component: ShuanggouDetail }, // 双沟设色-画作 { path: '/shuanggou-painting-detail', name: 'ShuanggouPaintingDetail', component: ShuanggouPaintingDetail, }, ] 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