import Vue from 'vue' import Router from 'vue-router' /* Layout */ import Layout from '@/views/layout/Layout' Vue.use(Router) /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) * redirect: noredirect if `redirect:noredirect` will no redirct in the breadcrumb * name:'router-name' the name is used by (must set!!!) * meta : { title: 'title' the name show in submenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar, noCache: true if true ,the page will no be cached(default is false) } **/ export const constantRouterMap = [ { path: '/login', component: () => import('@/views/login/index'), hidden: true }, { path: '/404', component: () => import('@/views/errorPage/404'), hidden: true }, { path: '/401', component: () => import('@/views/errorPage/401'), hidden: true }, { path: '', component: Layout, redirect: 'dashboard', children: [{ path: 'dashboard', component: () => import('@/views/dashboard/index'), name: 'dashboard', meta: { title: 'dashboard', icon: 'dashboard' } }] } ] export default new Router({ mode: 'history', scrollBehavior: () => ({ y: 0 }), routes: constantRouterMap }) const asyncRouters = [ // 商品管理 { path: '/pj', component: Layout, redirect: '/pj/pj-goods-list', name: 'ncs', meta: { title: 'goods', icon: 'goods-manage' }, children: [ { path: 'pj-goods-edit/:id(\\d+)', component: () => import('@/views/goods/goodsEdit'), name: 'pjGoodsEdit', meta: { title: 'goodsEdit', noCache: true }, hidden: true }, { path: 'pj-goods-list', component: () => import('@/views/goods/goodsList'), name: 'pjGoodsList', meta: { title: 'goodsList' }}, { path: 'pj-goods-detail/:id(\\d+)', component: () => import('@/views/goods/goodsDetail'), name: 'goodsDetail', meta: { title: 'goodsEdit', noCache: true }, hidden: true }, { path: 'pj-goods-list-view', component: () => import('@/views/goods/goodsListView'), name: 'goodsListView', meta: { title: 'goodsList' }}, { path: 'pj-draft', component: () => import('@/views/pjDraft/List'), name: 'pjDraftList', meta: { title: 'pjDraftList' }}, { path: 'pj-self-draft', component: () => import('@/views/pjDraft/SelfList'), name: 'pjDraftListSelf', meta: { title: 'pjDraftList' }}, { path: 'pj-draft-edit/:id(\\d+)', component: () => import('@/views/pjDraft/Edit'), name: 'draftEdit', meta: { title: 'draftEdit', noCache: true }, hidden: true }, { path: 'pj-draft-goods/:id(\\d+)', component: () => import('@/views/pjDraft/FsGoods'), name: 'draftFsGoods', meta: { title: 'draftFsGoods', noCache: true }, hidden: true }, { path: 'pj-order', component: () => import('@/views/pjOrder/List'), name: 'pjOrderList', meta: { title: 'pjOrderList' }}, { path: 'pj-self-order', component: () => import('@/views/pjOrder/SelfList'), name: 'pjOrderListSelf', meta: { title: 'pjOrderList' }}, { path: 'pj-order-edit/:id(\\d+)', component: () => import('@/views/pjOrder/Edit'), name: 'pjOrderEdit', meta: { title: 'pjOrderEdit', noCache: true }, hidden: true }, { path: 'pj-order-items', component: () => import('@/views/pjOrder/Items'), name: 'pjOrderItemsList', meta: { title: 'pjOrderItemsList' }}, { path: 'pj-order-items-deail/:id(\\d+)', component: () => import('@/views/pjOrder/ItemDetail'), name: 'pjOrderItemDetail', meta: { title: 'pjOrderItemDetail', noCache: true }, hidden: true } ] }, { path: '*', redirect: '/404', hidden: true } ] export const asyncRouterMap = asyncRouters