123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- import Vue from 'vue'
- import VueRouter from 'vue-router'
- Vue.use(VueRouter)
- const routes = [
- {
- path: '/',
- name: 'home',
- component: () => import('../views/Home/index.vue'),
- meta: {
- myTitle: '徽韵江城'
- },
- },
- // 语音讲解
- {
- path: '/goods/audio',
- name: 'goodsAudio',
- component: () => import('../views/Goods/components/GoodsAudio.vue')
- },
- {
- path: '/layout',
- name: 'layout',
- component: () => import('../views/Layout/index.vue'),
- children: [{
- path: '/layout/construct',
- name: 'construct',
- meta: {
- myInd: 1,
- myTitle: '古建一张图'
- },
- component: () => import('../views/Construct/index.vue')
- },
- {
- path: '/layout/goods',
- name: 'goods',
- meta: {
- myInd: 1,
- },
- component: () => import('../views/Goods/index.vue')
- },
- {
- path: '/layout/construct',
- name: 'construct',
- meta: {
- myInd: 1,
- myTitle: '古建一张图'
- },
- component: () => import('../views/Construct/index.vue')
- },
- {
- path: '/layout/serve',
- name: 'serve',
- meta: {
- myInd: 2,
- myTitle: '享·服务',
- },
- component: () => import('../views/Serve/index.vue')
- },
- {
- path: '/layout/serve/recommended-path',
- name: 'RecommendedPath',
- meta: {
- myInd: 2,
- myTitle: '推荐路线',
- },
- component: () => import('../views/Serve/RecommendedPath.vue')
- },
- {
- path: '/layout/interact',
- name: 'interact',
- meta: {
- myInd: 3
- },
- component: () => import('../views/Interact/index.vue')
- },
- {
- path: '/layout/my',
- name: 'my',
- meta: {
- myInd: 4
- },
- component: () => import('../views/My/index.vue')
- }
- ]
- },
- ]
- const router = new VueRouter({
- routes
- })
- // 全局后置钩子,设置title
- router.afterEach(to => {
- // 设置title
- if (to.meta.myTitle) window.document.title = to.meta.myTitle;
- })
- export default router
|