zoukankan      html  css  js  c++  java
  • vue-x 解决微信头部标题问题

    import Vue from 'vue'
    import Vuex from 'vuex'
    
    Vue.use(Vuex)
    
    export default new Vuex.Store({
        state: {
    
        },
        getters: {
    
        },
        mutations: {
       
        },
        actions: {
            changeTitle({commit}, title){
               document.title = title
            },
        }
    })
    import Vue from 'vue'
    import VueRouter from 'vue-router'
    import Store from '../store'
    
    Vue.use(VueRouter)
    
    const routes = [{
            path: '/',
            component: (resolve) => require(['../pages/mall/mall.vue'], resolve),
            meta: {
                title: '点外卖',
            }
        },
        {
            path: '/order',
            component: (resolve) => require(['../pages/order/order.vue'], resolve),
            meta: {
                title: '订单详情',
            }
        },
        {
            path: '/orderDetail',
            component: (resolve) => require(['../pages/order/detailOrderPage.vue'], resolve),
            meta: {
                title: '订单详情',
            }
        },
        {
            path: '/orderList',
            component: (resolve) => require(['../pages/order/orderList.vue'], resolve),
            meta: {
                title: '订单列表详情',
            }
        },
        {
            path: '/addressList',
            component: (resolve) => require(['../pages/address/address-list.vue'], resolve),
            meta: {
                title: '地址详情',
            }
        },
        {
            path: '/newAddress',
            component: (resolve) => require(['../pages/address/new-address.vue'], resolve),
            meta: {
                title: '新增地址',
            }
        },
        {
            path: '/personal',
            component: (resolve) => require(['../pages/personal/personalPage.vue'], resolve),
            meta: {
                title: '个人中心',
            }
        },
        {
            path: '/binding',
            component: (resolve) => require(['../pages/binding/binding.vue'], resolve),
            meta: {
                title: '账户绑定',
            }
        },
        {
            path: '/accountManage',
            component: (resolve) => require(['../pages/binding/accountManage.vue'], resolve),
            meta: {
                title: '账户管理',
            }
        },
    ]
    
    // 路由配置
    const router = new VueRouter({
        routes
    })
    
    // router.beforeEach((to, from, next) => {
    //     next()
    // })
    //
    router.afterEach((to) => {
        Store.dispatch('changeTitle', to.meta.title)
    })
    
    export default router
  • 相关阅读:
    项目开发环境
    angluarjs2入门学习资源
    mosquitto安装和测试
    loj#6031. 「雅礼集训 2017 Day1」字符串(SAM 广义SAM 数据分治)
    loj#6030. 「雅礼集训 2017 Day1」矩阵(贪心 构造)
    loj#6029. 「雅礼集训 2017 Day1」市场(线段树)
    HDU4609 3-idiots(生成函数)
    loj#6436. 「PKUSC2018」神仙的游戏(生成函数)
    BZOJ3028: 食物(生成函数)
    洛谷P4841 城市规划(生成函数 多项式求逆)
  • 原文地址:https://www.cnblogs.com/MR-cui/p/8617893.html
Copyright © 2011-2022 走看看