import Vue from 'vue'
import Router from 'vue-router'

import routerBefore from '@/config/routerBefore.js'
// 主要
// import main from '@/components/main.vue'
// 页面示例
// import mypage from '../components/myPage.vue'
Vue.use(Router)
const constantRouterMap = [{
  path: '/',
  name: 'main',
  component: resolve => require(['@/components/main.vue'], resolve),
  redirect: {
    name: 'inspectionMaterials'
  },
  children: [
    {
      path: 'inspectionMaterials',
      name: 'inspectionMaterials',
      component: resolve => require(['../components/inspectionMaterials/inspectionMaterials.vue'], resolve)
    }, {
      path: 'inspectionProudects',
      name: 'inspectionProudects',
      component: resolve => require(['../components/inspectionProudects/inspectionProudects.vue'], resolve)
    }, {
      path: 'temporaryEntrust',
      name: 'temporaryEntrust',
      component: resolve => require(['../components/temporaryEntrust/temporaryEntrust.vue'], resolve)
    },{
      path: 'inspectionControl',
      name: 'inspectionControl',
      component: resolve => require(['../components/inspectionControl/inspectionControl.vue'], resolve)
    },{
      path: 'spotCheck',
      name: 'spotCheck',
      component: resolve => require(['../components/spotCheck/spotCheck.vue'], resolve)
    },{
      path: 'cableNews',
      name: 'cableNews',
      component: resolve => require(['../components/cableNews/cableNews.vue'], resolve)
    },{
      path: 'businessKanban',
      name: 'businessKanban',
      component: resolve => require(['../components/businessKanban/businessKanban.vue'], resolve)
    },{
      path: 'inspectionMaterialsGit',
      name: 'inspectionMaterialsGit',
      component: resolve => require(['../components/inspectionMaterials/inspectionMaterialsGit.vue'], resolve)
    }
    ],
}];
const router = new Router({
  routes: constantRouterMap
})

//  before
routerBefore(router, constantRouterMap);

export default router;
//  constantRouterMap
export const routes = constantRouterMap;
// export default new Router({
//   routes: [
//     {
//       path: '/',
//       name: 'main',
//       component: main,
//       redirect: {name: 'mypage'},
//       children: [
//         {path: 'mypage', name: 'mypage', component: mypage}
//         ]
//     }
//   ]
// })
