index.js 2.63 KB
import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);
const router = new VueRouter({
    routes: [
        {
            path: '/',
            redirect: '/list'
        },
        {
            path: '/',
            component: () => import('@/layout/index.vue'),
            redirect: '/list',
            children: [
                {
                    //禁止修改命名list 其他地方用到
                    path: 'list',
                    component: () => import('@/views/defaultList.vue'),
                    name: 'list',
                    meta: { title: $gl("kanbanLsit") },
                },

                {
                    path: 'sorting',
                    component: () => import('@/views/sorting'),
                    name: 'sorting',
                    meta: { title: '金叠利拣选看板P1014' },

                },
                {
                    path: 'sortingTwo',
                    component: () => import('@/views/sortingTwo'),
                    name: 'sortingTwo',
                    meta: { title: '金叠利拣选看板P1001' },

                },
                {
                    path: 'sortingThree',
                    component: () => import('@/views/sortingThree'),
                    name: 'sortingThree',
                    meta: { title: '金叠利拣选看板P2026' },

                },
                {
                    path: 'sortingFour',
                    component: () => import('@/views/sortingFour'),
                    name: 'sortingFour',
                    meta: { title: '金叠利拣选看板P2002' },

                },
                {
                    path: 'managePlatform_duanZi',
                    component: () => import('@/views/managePlatform_duanZi'),
                    name: 'managePlatform_duanZi',
                    meta: { title: '金叠利中控管理平台' },
                },
                // {
                //     path: 'dome',
                //     component: () => import('@/views/dome'),
                //     name: 'dome',
                //     meta: { title: 'dome' },
                // },
            ],

        },
    ]
})

var routerArr = router.options.routes;
var allRouter = null;
if (routerArr.length > 1) {
    allRouter = allRouter = routerArr[1].children;
}
router.afterEach((to, from) => {
    //console.log('后置路由守卫', to, from);
    var path = from.path;
    if (allRouter != null) {
        for (let i = 0; i < allRouter.length; i++) {
            var tempPath = "/" + allRouter[i].path;
            if (path == tempPath) window.location.reload();
        }
    }
})
export default router;