123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- import { createRouter, createWebHashHistory } from 'vue-router'
- import LoginView from "../views/LoginView.vue"
- import HomeView from '../views/HomeView.vue'
- import RelicSearch from '../views/RelicSearch.vue'
- // import store from '@/store/index.js'
- const routes = [
- {
- path: '/',
- redirect: '/tab-1',
- },
- {
- path: '/login',
- name: 'LoginView',
- component: LoginView,
- },
- {
- path: '/tab-1',
- name: 'HomeView',
- component: HomeView,
- meta: {
- tabIdx: 1
- },
- children: [
- {
- path: '/relic-search',
- name: 'RelicSearch',
- component: RelicSearch,
- },
- ],
- },
- // {
- // path: '/tab-2',
- // name: 'HomeView',
- // component: HomeView,
- // meta: {
- // tabIdx: 2
- // }
- // },
- // {
- // path: '/tab-3',
- // name: 'HomeView',
- // component: HomeView,
- // meta: {
- // tabIdx: 3
- // }
- // },
- // {
- // path: '/tab-4',
- // name: 'HomeView',
- // component: HomeView,
- // meta: {
- // tabIdx: 4
- // }
- // },
- // {
- // path: '/tab-5',
- // name: 'HomeView',
- // component: HomeView,
- // meta: {
- // tabIdx: 5
- // }
- // },
- // {
- // path: '/tab-6',
- // name: 'HomeView',
- // component: HomeView,
- // meta: {
- // tabIdx: 6
- // }
- // },
- // {
- // path: '/tab-7',
- // name: 'HomeView',
- // component: HomeView,
- // meta: {
- // tabIdx: 7
- // }
- // },
- // {
- // path: '/tab-8',
- // name: 'HomeView',
- // component: HomeView,
- // meta: {
- // tabIdx: 8
- // }
- // },
- ]
- 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
|