import Router from 'vue-router';
import API from '../config/api';

Vue.use(Router);

var router = new Router({
    history: true
});
router.map({
    '/': {
        component(resolve) {
            require(['../features/home/index.vue'], resolve);
        }
    },
    'home': {
        component(resolve) {
            require(['../features/home/index.vue'], resolve);
        }
    },
    'goods': {
        component(resolve) {
            require(['../features/goods/index.vue'], resolve);
        },
        subRoutes: {
            '/': {
                component(resolve) {
                    require(['../features/goods/analysis.vue'], resolve);
                }
            },
            '/analysis': {
                component(resolve) {
                    require(['../features/goods/analysis.vue'], resolve);
                }
            },
            '/list': {
                component(resolve) {
                    require(['../features/goods/goodList.vue'], resolve);
                }
            },
            '/create': {
                component(resolve) {
                    require(['../features/goods/create.vue'], resolve);
                }
            },
            '/in': {
                component(resolve) {
                    require(['../features/goods/in.vue'], resolve);
                }
            },
            '/out': {
                component(resolve) {
                    require(['../features/goods/out.vue'], resolve);
                }
            },
            '/inList': {
                component(resolve) {
                    require(['../features/goods/inList.vue'], resolve);
                }
            },
            '/outList': {
                component(resolve) {
                    require(['../features/goods/outList.vue'], resolve);
                }
            },
            '/detail/:id': {
                name: 'detail',
                component(resolve) {
                    require(['../features/goods/detail.vue'], resolve);
                }
            },
            '/attr/:id': {
                name: 'good-attr',
                component(resolve) {
                    require(['../features/goods/goodAttr.vue'], resolve);
                }
            }
        }
    },
    'order': {
        component(resolve) {
            require(['../features/order/index.vue'], resolve);
        },
        subRoutes: {
            '/': {
                component(resolve) {
                    require(['../features/order/list.vue'], resolve);
                }
            },
            '/list': {
                component(resolve) {
                    require(['../features/order/list.vue'], resolve);
                }
            },
            '/create': {
                component(resolve) {
                    require(['../features/order/create.vue'], resolve);
                }
            }
        }
    }
});

export default router;
@@ -92,24 +92,97 @@
 uter
- = new Router(%7B%0A
+;%0Aif (WEBPACK_DEBUG) %7B%0A    router = new Router();%0A%7D else %7B%0A    router = new Router(%7B%0A    
     
@@ -195,19 +195,26 @@
 y: true%0A
-%7D);
+    %7D);%0A%7D%0A
 %0Arouter.

change router