Authored by 陈峰

dynamic import

@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 "plugins": [ 5 "plugins": [
6 "transform-runtime", 6 "transform-runtime",
7 "transform-vue-jsx", 7 "transform-vue-jsx",
8 - "transform-object-rest-spread" 8 + "transform-object-rest-spread",
  9 + "syntax-dynamic-import"
9 ] 10 ]
10 } 11 }
1 { 1 {
  2 + "parser": "babel-eslint",
2 "env": { 3 "env": {
3 "es6": true 4 "es6": true
4 }, 5 },
@@ -13,5 +14,4 @@ @@ -13,5 +14,4 @@
13 "camelcase": "off", 14 "camelcase": "off",
14 "max-len": "off" 15 "max-len": "off"
15 } 16 }
16 -  
17 } 17 }
@@ -102,7 +102,7 @@ lang=scss @@ -102,7 +102,7 @@ lang=scss
102 ``` 102 ```
103 103
104 #### 3.路由规范: 104 #### 3.路由规范:
105 -用webpack的code split方式加载页面模块,chunkname为[module].[page] 105 +用webpack的code split lazy方式加载页面模块,chunkname为[module].[page]
106 106
107 路由meta元信息: 107 路由meta元信息:
108 ``` js 108 ``` js
@@ -111,12 +111,10 @@ lang=scss @@ -111,12 +111,10 @@ lang=scss
111 } 111 }
112 ``` 112 ```
113 ``` js 113 ``` js
114 -const page = r => require.ensure([], () => r(require('./onsale')), 'product.onsale');  
115 -  
116 export default { 114 export default {
117 path: '/onsale.html', 115 path: '/onsale.html',
118 name: 'onsale', 116 name: 'onsale',
119 - component: page, 117 + component: () => import(/* webpackChunkName: "product.onsale" */'./onsale),
120 meta: { 118 meta: {
121 pageName: '在售商品' 119 pageName: '在售商品'
122 } 120 }
@@ -2,79 +2,80 @@ @@ -2,79 +2,80 @@
2 import _ from 'lodash'; 2 import _ from 'lodash';
3 import MultiImage from './multi-image'; 3 import MultiImage from './multi-image';
4 4
5 -const component = (resolve) => {  
6 - require.ensure([], () => {  
7 - const VueHtml5Editor = require('vue-html5-editor');  
8 - const editorInstance = new VueHtml5Editor({  
9 - hiddenModules: ['info', 'image'],  
10 - visibleModules: [  
11 - 'text',  
12 - 'color',  
13 - 'font',  
14 - 'align',  
15 - 'list',  
16 - 'link',  
17 - 'unlink',  
18 - 'tabulation',  
19 - 'multi-image',  
20 - 'hr',  
21 - 'eraser',  
22 - 'undo',  
23 - 'full-screen',  
24 - 'info',  
25 - ],  
26 - icons: {  
27 - text: 'iconfont icon-pencil',  
28 - color: 'iconfont icon-paintbrush',  
29 - font: 'iconfont icon-font',  
30 - align: 'iconfont icon-alignjustify',  
31 - list: 'iconfont icon-list',  
32 - link: 'iconfont icon-chain',  
33 - unlink: 'iconfont icon-chainbroken',  
34 - tabulation: 'iconfont icon-table',  
35 - image: 'iconfont icon-images',  
36 - 'multi-image': 'iconfont icon-images',  
37 - hr: 'iconfont icon-minus',  
38 - eraser: 'iconfont icon-eraser',  
39 - undo: 'iconfont icon-undo',  
40 - 'full-screen': 'iconfont icon-arrows-alt',  
41 - },  
42 - image: {  
43 - sizeLimit: 512 * 1024,  
44 - upload: {  
45 - url: '/Api/upload/image',  
46 - headers: {},  
47 - params: {  
48 - bucket: 'goodsimg'  
49 - },  
50 - fieldName: 'file'  
51 - },  
52 - compress: null,  
53 - uploadHandler(responseText) {  
54 - let json = JSON.parse(responseText);  
55 -  
56 - if (json.code === 200) {  
57 - return _.get(json, 'data.imagesList[0]', '');  
58 - }  
59 - return json.data;  
60 - }  
61 - },  
62 - language: 'zh-cn',  
63 - modules: [{  
64 - name: 'multi-image',  
65 - icon: 'fa fa-file-image-o',  
66 - i18n: '多图片上传',  
67 - show: true,  
68 - dashboard: MultiImage  
69 - }]  
70 - });  
71 -  
72 - resolve(editorInstance);  
73 - }, 'components.editor');  
74 -};  
75 5
76 6
77 export default [ 7 export default [
78 'editor', 8 'editor',
79 - component 9 + () => ({
  10 + component: import(/* webpackChunkName: "components.editor" */'vue-html5-editor').then(VueHtml5Editor => {
  11 + const editorInstance = new VueHtml5Editor({
  12 + hiddenModules: ['info', 'image'],
  13 + visibleModules: [
  14 + 'text',
  15 + 'color',
  16 + 'font',
  17 + 'align',
  18 + 'list',
  19 + 'link',
  20 + 'unlink',
  21 + 'tabulation',
  22 + 'multi-image',
  23 + 'hr',
  24 + 'eraser',
  25 + 'undo',
  26 + 'full-screen',
  27 + 'info',
  28 + ],
  29 + icons: {
  30 + text: 'iconfont icon-pencil',
  31 + color: 'iconfont icon-paintbrush',
  32 + font: 'iconfont icon-font',
  33 + align: 'iconfont icon-alignjustify',
  34 + list: 'iconfont icon-list',
  35 + link: 'iconfont icon-chain',
  36 + unlink: 'iconfont icon-chainbroken',
  37 + tabulation: 'iconfont icon-table',
  38 + image: 'iconfont icon-images',
  39 + 'multi-image': 'iconfont icon-images',
  40 + hr: 'iconfont icon-minus',
  41 + eraser: 'iconfont icon-eraser',
  42 + undo: 'iconfont icon-undo',
  43 + 'full-screen': 'iconfont icon-arrows-alt',
  44 + },
  45 + image: {
  46 + sizeLimit: 512 * 1024,
  47 + upload: {
  48 + url: '/Api/upload/image',
  49 + headers: {},
  50 + params: {
  51 + bucket: 'goodsimg'
  52 + },
  53 + fieldName: 'file'
  54 + },
  55 + compress: null,
  56 + uploadHandler(responseText) {
  57 + let json = JSON.parse(responseText);
  58 +
  59 + if (json.code === 200) {
  60 + return _.get(json, 'data.imagesList[0]', '');
  61 + }
  62 + return json.data;
  63 + }
  64 + },
  65 + language: 'zh-cn',
  66 + modules: [{
  67 + name: 'multi-image',
  68 + icon: 'fa fa-file-image-o',
  69 + i18n: '多图片上传',
  70 + show: true,
  71 + dashboard: MultiImage
  72 + }]
  73 + });
  74 +
  75 + return editorInstance;
  76 + }),
  77 + loading: {
  78 + },
  79 + error: {}
  80 + })
80 ]; 81 ];
1 -const home = r => require.ensure([], () => r(require('./login')), 'login');  
2 -const error = r => require.ensure([], () => r(require('./error')), 'error');  
3 -  
4 const router = [{ 1 const router = [{
5 path: '/login.html', 2 path: '/login.html',
6 name: 'login', 3 name: 'login',
7 - component: home, 4 + component: () => import(/* webpackChunkName: "common" */'./login'),
8 meta: { 5 meta: {
9 authPass: true 6 authPass: true
10 } 7 }
11 }, { 8 }, {
12 path: '/401.html', 9 path: '/401.html',
13 name: 'error.401', 10 name: 'error.401',
14 - component: error, 11 + component: () => import(/* webpackChunkName: "common" */'./error'),
15 meta: { 12 meta: {
16 authPass: true 13 authPass: true
17 } 14 }
18 }, { 15 }, {
19 path: '*', 16 path: '*',
20 name: 'error.404', 17 name: 'error.404',
21 - component: error, 18 + component: () => import(/* webpackChunkName: "common" */'./error'),
22 meta: { 19 meta: {
23 authPass: true 20 authPass: true
24 } 21 }
25 }, { 22 }, {
26 path: '/500.html', 23 path: '/500.html',
27 name: 'error.500', 24 name: 'error.500',
28 - component: error, 25 + component: () => import(/* webpackChunkName: "common" */'./error'),
29 meta: { 26 meta: {
30 authPass: true 27 authPass: true
31 } 28 }
1 -const page = r => require.ensure([], () => r(require('./clearing')), 'finance.clearing');  
2 -  
3 export default { 1 export default {
4 path: '/clearing.html', 2 path: '/clearing.html',
5 name: 'clearing', 3 name: 'clearing',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "finance.clearing" */'./clearing'),
7 meta: { 5 meta: {
8 pageName: '对账单' 6 pageName: '对账单'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./clearing')), 'finance.clearing');  
2 -  
3 export default { 1 export default {
4 path: '/clearing.html', 2 path: '/clearing.html',
5 name: 'clearing', 3 name: 'clearing',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "finance.clearing" */'./clearing'),
7 meta: { 5 meta: {
8 pageName: '结算单' 6 pageName: '结算单'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./payment')), 'finance.payment');  
2 -  
3 export default { 1 export default {
4 path: '/payment.html', 2 path: '/payment.html',
5 name: 'payment', 3 name: 'payment',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "finance.payment" */'./payment'),
7 meta: { 5 meta: {
8 pageName: '结算单' 6 pageName: '结算单'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./payment')), 'finance.payment');  
2 -  
3 export default { 1 export default {
4 path: '/payment.html', 2 path: '/payment.html',
5 name: 'payment', 3 name: 'payment',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "finance.payment" */'./payment'),
7 meta: { 5 meta: {
8 pageName: '结算单' 6 pageName: '结算单'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./overview')), 'home.overview');  
2 -  
3 export default { 1 export default {
4 path: '/overview.html', 2 path: '/overview.html',
5 name: 'overview', 3 name: 'overview',
6 - component: page 4 + component: () => import(/* webpackChunkName: "home.overview" */'./overview'),
7 }; 5 };
1 /** 1 /**
2 * Created by TaoHuang on 2017/4/18. 2 * Created by TaoHuang on 2017/4/18.
3 */ 3 */
4 -const step1 = r => require.ensure([], () => r(require('./step1')), 'product.create');  
5 -const step2 = r => require.ensure([], () => r(require('./step2')), 'product.create');  
6 -const step3 = r => require.ensure([], () => r(require('./step3')), 'product.create');  
7 -  
8 -  
9 export default [{ 4 export default [{
10 path: 'step1.html', 5 path: 'step1.html',
11 name: 'step1', 6 name: 'step1',
12 - component: step1, 7 + component: () => import(/* webpackChunkName: "product.create" */'./step1'),
13 meta: { 8 meta: {
14 pageName: '类目选择', 9 pageName: '类目选择',
15 } 10 }
16 }, { 11 }, {
17 path: 'step2.html', 12 path: 'step2.html',
18 name: 'step2', 13 name: 'step2',
19 - component: step2, 14 + component: () => import(/* webpackChunkName: "product.create" */'./step2'),
20 meta: { 15 meta: {
21 pageName: '基础信息', 16 pageName: '基础信息',
22 } 17 }
23 }, { 18 }, {
24 path: 'step3.html', 19 path: 'step3.html',
25 name: 'step3', 20 name: 'step3',
26 - component: step3, 21 + component: () => import(/* webpackChunkName: "product.create" */'./step3'),
27 meta: { 22 meta: {
28 pageName: '网销信息', 23 pageName: '网销信息',
29 } 24 }
@@ -2,14 +2,12 @@ @@ -2,14 +2,12 @@
2 * Created by TaoHuang on 2017/4/18. 2 * Created by TaoHuang on 2017/4/18.
3 */ 3 */
4 4
5 -const createProduct = r => require.ensure([], () => r(require('./create')), 'product.create');  
6 -  
7 import childrenViews from './components'; 5 import childrenViews from './components';
8 6
9 export default { 7 export default {
10 path: '/create', 8 path: '/create',
11 name: 'create', 9 name: 'create',
12 - component: createProduct, 10 + component: () => import(/* webpackChunkName: "product.create" */'./create'),
13 children: childrenViews, 11 children: childrenViews,
14 meta: { 12 meta: {
15 pageName: '新增商品', 13 pageName: '新增商品',
1 /** 1 /**
2 * Created by TaoHuang on 2017/4/26. 2 * Created by TaoHuang on 2017/4/26.
3 */ 3 */
4 -const editProduct = r => require.ensure([], () => r(require('./edit')), 'product.edit');  
5 -  
6 export default { 4 export default {
7 path: '/edit/:id.html', 5 path: '/edit/:id.html',
8 name: 'edit', 6 name: 'edit',
9 - component: editProduct 7 + component: () => import(/* webpackChunkName: "product.edit" */'./edit'),
10 }; 8 };
1 -const page = r => require.ensure([], () => r(require('./offsale')), 'product.offsale');  
2 -  
3 export default { 1 export default {
4 path: '/offsale.html', 2 path: '/offsale.html',
5 name: 'offsale', 3 name: 'offsale',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "product.offsale" */'./offsale'),
7 meta: { 5 meta: {
8 pageName: '未上架商品' 6 pageName: '未上架商品'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./onsale')), 'product.onsale');  
2 -  
3 export default { 1 export default {
4 path: '/onsale.html', 2 path: '/onsale.html',
5 name: 'onsale', 3 name: 'onsale',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "product.onsale" */'./onsale'),
7 meta: { 5 meta: {
8 pageName: '在售商品' 6 pageName: '在售商品'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./output')), 'product.output');  
2 -  
3 export default { 1 export default {
4 path: '/output.html', 2 path: '/output.html',
5 name: 'output', 3 name: 'output',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "product.output" */'./output'),
7 meta: { 5 meta: {
8 pageName: '批量功能' 6 pageName: '批量功能'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./vips')), 'product.vips');  
2 -  
3 export default { 1 export default {
4 path: '/vips.html', 2 path: '/vips.html',
5 name: 'vips', 3 name: 'vips',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "product.vips" */'./vips'),
7 meta: { 5 meta: {
8 pageName: 'VIP价格管理' 6 pageName: 'VIP价格管理'
9 } 7 }
@@ -3,12 +3,10 @@ @@ -3,12 +3,10 @@
3 * Created by TaoHuang on 2017/5/4. 3 * Created by TaoHuang on 2017/5/4.
4 */ 4 */
5 5
6 -const page = r => require.ensure([], () => r(require('./diff')), 'repository.diff');  
7 -  
8 export default { 6 export default {
9 path: '/diff.html', 7 path: '/diff.html',
10 name: 'diff', 8 name: 'diff',
11 - component: page, 9 + component: () => import(/* webpackChunkName: "repository.diff" */'./diff'),
12 meta: { 10 meta: {
13 pageName: '差异库存' 11 pageName: '差异库存'
14 } 12 }
@@ -3,12 +3,10 @@ @@ -3,12 +3,10 @@
3 * Created by TaoHuang on 2017/5/4. 3 * Created by TaoHuang on 2017/5/4.
4 */ 4 */
5 5
6 -const page = r => require.ensure([], () => r(require('./diff')), 'repository.diff');  
7 -  
8 export default { 6 export default {
9 path: '/diff.html', 7 path: '/diff.html',
10 name: 'diff', 8 name: 'diff',
11 - component: page, 9 + component: () => import(/* webpackChunkName: "repository.diff" */'./diff'),
12 meta: { 10 meta: {
13 pageName: '差异库存' 11 pageName: '差异库存'
14 } 12 }
@@ -2,20 +2,17 @@ @@ -2,20 +2,17 @@
2 * Created by TaoHuang on 2017/5/26. 2 * Created by TaoHuang on 2017/5/26.
3 */ 3 */
4 4
5 -const list = r => require.ensure([], () => r(require('./list')), 'repository.express');  
6 -const info = r => require.ensure([], () => r(require('./info')), 'repository.express');  
7 -  
8 export default [{ 5 export default [{
9 path: '/list.html', 6 path: '/list.html',
10 name: 'list', 7 name: 'list',
11 - component: list, 8 + component: () => import(/* webpackChunkName: "repository.express" */'./list'),
12 meta: { 9 meta: {
13 pageName: '入库物流管理' 10 pageName: '入库物流管理'
14 } 11 }
15 }, { 12 }, {
16 path: '/:id.html', 13 path: '/:id.html',
17 name: 'info', 14 name: 'info',
18 - component: info, 15 + component: () => import(/* webpackChunkName: "repository.express" */'./info'),
19 meta: { 16 meta: {
20 pageName: '入库物流详情' 17 pageName: '入库物流详情'
21 } 18 }
1 /** 1 /**
2 * Created by TaoHuang on 2017/5/25. 2 * Created by TaoHuang on 2017/5/25.
3 */ 3 */
4 -  
5 -const list = r => require.ensure([], () => r(require('./list')), 'repository.invoice');  
6 -const edit = r => require.ensure([], () => r(require('./edit')), 'repository.invoice');  
7 -const info = r => require.ensure([], () => r(require('./info')), 'repository.invoice');  
8 -const deliver = r => require.ensure([], () => r(require('./deliver')), 'repository.invoice');  
9 -  
10 export default [{ 4 export default [{
11 path: '/list.html', 5 path: '/list.html',
12 name: 'list', 6 name: 'list',
13 - component: list, 7 + component: () => import(/* webpackChunkName: "repository.invoice" */'./list'),
14 meta: { 8 meta: {
15 pageName: '发货入库管理' 9 pageName: '发货入库管理'
16 } 10 }
17 }, { 11 }, {
18 path: '/edit/:id.html', 12 path: '/edit/:id.html',
19 name: 'edit', 13 name: 'edit',
20 - component: edit, 14 + component: () => import(/* webpackChunkName: "repository.invoice" */'./edit'),
21 meta: { 15 meta: {
22 pageName: '发货入库编辑' 16 pageName: '发货入库编辑'
23 } 17 }
24 }, { 18 }, {
25 path: '/info/:id.html', 19 path: '/info/:id.html',
26 name: 'info', 20 name: 'info',
27 - component: info, 21 + component: () => import(/* webpackChunkName: "repository.invoice" */'./info'),
28 meta: { 22 meta: {
29 pageName: '发货入库详情' 23 pageName: '发货入库详情'
30 } 24 }
31 }, { 25 }, {
32 path: '/deliver/:id.html', 26 path: '/deliver/:id.html',
33 name: 'deliver', 27 name: 'deliver',
34 - component: deliver, 28 + component: () => import(/* webpackChunkName: "repository.invoice" */'./deliver'),
35 meta: { 29 meta: {
36 pageName: '发货入库发货' 30 pageName: '发货入库发货'
37 } 31 }
@@ -2,12 +2,10 @@ @@ -2,12 +2,10 @@
2 * 可调拨库存 2 * 可调拨库存
3 * Created by TaoHuang on 2017/5/4. 3 * Created by TaoHuang on 2017/5/4.
4 */ 4 */
5 -const page = r => require.ensure([], () => r(require('./jit')), 'repository.jit');  
6 -  
7 export default { 5 export default {
8 path: '/jit.html', 6 path: '/jit.html',
9 name: 'jit', 7 name: 'jit',
10 - component: page, 8 + component: () => import(/* webpackChunkName: "repository.jit" */'./jit'),
11 meta: { 9 meta: {
12 pageName: '可调拨库存' 10 pageName: '可调拨库存'
13 } 11 }
1 -const list = r => require.ensure([], () => r(require('./list')), 'repository.prodReturn');  
2 -const detail = r => require.ensure([], () => r(require('./detail')), 'repository.prodReturn');  
3 -  
4 export default [{ 1 export default [{
5 path: '/list.html', 2 path: '/list.html',
6 name: 'list', 3 name: 'list',
7 - component: list, 4 + component: () => import(/* webpackChunkName: "repository.prodReturn" */'./list'),
8 meta: { 5 meta: {
9 pageName: '请退单列表' 6 pageName: '请退单列表'
10 } 7 }
11 }, { 8 }, {
12 path: '/detail/:id.html', 9 path: '/detail/:id.html',
13 name: 'detail', 10 name: 'detail',
14 - component: detail, 11 + component: () => import(/* webpackChunkName: "repository.prodReturn" */'./detail'),
15 meta: { 12 meta: {
16 pageName: '请退单详情' 13 pageName: '请退单详情'
17 } 14 }
1 -const page = r => require.ensure([], () => r(require('./supplement')), 'repository.supplement');  
2 -  
3 export default { 1 export default {
4 path: '/supplement.html', 2 path: '/supplement.html',
5 name: 'supplement', 3 name: 'supplement',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "repository.supplement" */'./supplement'),
7 meta: { 5 meta: {
8 pageName: '补货入库' 6 pageName: '补货入库'
9 } 7 }
1 /** 1 /**
2 * Created by TaoHuang on 2017/5/8. 2 * Created by TaoHuang on 2017/5/8.
3 */ 3 */
4 -  
5 -const list = r => require.ensure([], () => r(require('./list')), 'shop.category');  
6 -const edit = r => require.ensure([], () => r(require('./edit')), 'shop.category');  
7 -  
8 export default [{ 4 export default [{
9 path: '/list.html', 5 path: '/list.html',
10 name: 'list', 6 name: 'list',
11 - component: list, 7 + component: () => import(/* webpackChunkName: "shop.category" */'./list'),
12 meta: { 8 meta: {
13 pageName: '商品分类' 9 pageName: '商品分类'
14 } 10 }
15 }, { 11 }, {
16 path: '/edit.html', 12 path: '/edit.html',
17 name: 'edit', 13 name: 'edit',
18 - component: edit, 14 + component: () => import(/* webpackChunkName: "shop.category" */'./edit'),
19 meta: { 15 meta: {
20 pageName: '商品分类编辑' 16 pageName: '商品分类编辑'
21 } 17 }
1 -const decoraPC = r => require.ensure([], () => r(require('./decora-pc')), 'shop.decoration');  
2 -const decoraApp = r => require.ensure([], () => r(require('./decora-app')), 'shop.decoration');  
3 -  
4 export default [{ 1 export default [{
5 path: '/decor-app.html', 2 path: '/decor-app.html',
6 name: 'decor.app', 3 name: 'decor.app',
7 - component: decoraApp, 4 + component: () => import(/* webpackChunkName: "shop.decoration" */'./decora-app'),
8 meta: { 5 meta: {
9 pageName: '店铺装修App' 6 pageName: '店铺装修App'
10 } 7 }
11 }, { 8 }, {
12 path: '/decor-pc.html', 9 path: '/decor-pc.html',
13 name: 'decor.pc', 10 name: 'decor.pc',
14 - component: decoraPC, 11 + component: () => import(/* webpackChunkName: "shop.decoration" */'./decora-pc'),
15 meta: { 12 meta: {
16 pageName: '店铺装修PC' 13 pageName: '店铺装修PC'
17 } 14 }
1 -const page = r => require.ensure([], () => r(require('./info')), 'shop.info');  
2 -  
3 export default { 1 export default {
4 path: '/info.html', 2 path: '/info.html',
5 name: 'info', 3 name: 'info',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "shop.info" */'./info'),
7 meta: { 5 meta: {
8 pageName: '店铺基本信息' 6 pageName: '店铺基本信息'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./outinstore')), 'statistics.outinstore');  
2 -  
3 export default { 1 export default {
4 path: '/outinstore.html', 2 path: '/outinstore.html',
5 name: 'outinstore', 3 name: 'outinstore',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "statistics.outinstore" */'./outinstore'),
7 meta: { 5 meta: {
8 pageName: '出入库统计' 6 pageName: '出入库统计'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./overview')), 'statistics.overview');  
2 -  
3 export default { 1 export default {
4 path: '/overview.html', 2 path: '/overview.html',
5 name: 'overview', 3 name: 'overview',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "statistics.overview" */'./overview'),
7 meta: { 5 meta: {
8 pageName: '经营总览' 6 pageName: '经营总览'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./sale')), 'statistics.sale');  
2 -  
3 export default { 1 export default {
4 path: '/sale.html', 2 path: '/sale.html',
5 name: 'sale', 3 name: 'sale',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "statistics.sale" */'./sale'),
7 meta: { 5 meta: {
8 pageName: '销售统计' 6 pageName: '销售统计'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./stock')), 'statistics.stock');  
2 -  
3 export default { 1 export default {
4 path: '/stock.html', 2 path: '/stock.html',
5 name: 'stock', 3 name: 'stock',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "statistics.stock" */'./stock'),
7 meta: { 5 meta: {
8 pageName: '库存统计' 6 pageName: '库存统计'
9 } 7 }
1 -const allotList = r => require.ensure([], () => r(require('./allot-list')), 'trade.allotList');  
2 -  
3 export default { 1 export default {
4 path: '/allotList.html', 2 path: '/allotList.html',
5 name: 'allotlist', 3 name: 'allotlist',
6 - component: allotList, 4 + component: () => import(/* webpackChunkName: "trade.allotList" */'./allot-list'),
7 meta: { 5 meta: {
8 pageName: '调拨单' 6 pageName: '调拨单'
9 } 7 }
1 -const allot = r => require.ensure([], () => r(require('./allot')), 'trade.allot');  
2 -const done = r => require.ensure([], () => r(require('./views/done')), 'trade.allot');  
3 -const undone = r => require.ensure([], () => r(require('./views/undone')), 'trade.allot');  
4 -const express = r => require.ensure([], () => r(require('./views/express')), 'trade.allot');  
5 -  
6 export default { 1 export default {
7 path: '/allot', 2 path: '/allot',
8 name: 'allot', 3 name: 'allot',
9 - component: allot, 4 + component: () => import(/* webpackChunkName: "trade.allot" */'./allot'),
10 children: [ 5 children: [
11 { 6 {
12 path: 'done.html', 7 path: 'done.html',
13 name: 'done', 8 name: 'done',
14 - component: done, 9 + component: () => import(/* webpackChunkName: "trade.allot" */'./views/done'),
15 meta: { 10 meta: {
16 pageName: '发货已完成' 11 pageName: '发货已完成'
17 } 12 }
@@ -19,7 +14,7 @@ export default { @@ -19,7 +14,7 @@ export default {
19 { 14 {
20 path: 'undone.html', 15 path: 'undone.html',
21 name: 'undone', 16 name: 'undone',
22 - component: undone, 17 + component: () => import(/* webpackChunkName: "trade.allot" */'./views/undone'),
23 meta: { 18 meta: {
24 pageName: '发货未完成' 19 pageName: '发货未完成'
25 } 20 }
@@ -27,7 +22,7 @@ export default { @@ -27,7 +22,7 @@ export default {
27 { 22 {
28 path: 'express.html', 23 path: 'express.html',
29 name: 'express', 24 name: 'express',
30 - component: express, 25 + component: () => import(/* webpackChunkName: "trade.allot" */'./views/express'),
31 meta: { 26 meta: {
32 pageName: '发货物流表' 27 pageName: '发货物流表'
33 } 28 }
1 -const expDetail = r => require.ensure([], () => r(require('./express-detail')), 'trade.expdetail');  
2 -  
3 export default { 1 export default {
4 path: '/expdetail.html', 2 path: '/expdetail.html',
5 name: 'expdetail', 3 name: 'expdetail',
6 - component: expDetail, 4 + component: () => import(/* webpackChunkName: "trade.expdetail" */'./express-detail'),
7 meta: { 5 meta: {
8 pageName: '调拨订单' 6 pageName: '调拨订单'
9 } 7 }
1 -const printDetail = r => require.ensure([], () => r(require('./print-detail')), 'trade.printDetail');  
2 -  
3 export default { 1 export default {
4 path: '/printDetail.html', 2 path: '/printDetail.html',
5 name: 'printdetail', 3 name: 'printdetail',
6 - component: printDetail 4 + component: () => import(/* webpackChunkName: "trade.printDetail" */'./print-detail'),
7 }; 5 };
@@ -16,4 +16,4 @@ class DefaultCache { @@ -16,4 +16,4 @@ class DefaultCache {
16 } 16 }
17 } 17 }
18 18
19 -module.exports = DefaultCache; 19 +export default DefaultCache;
  1 +import DefaultCache from './default-cache';
1 let DbTypes = { 2 let DbTypes = {
2 DEF: 'default' 3 DEF: 'default'
3 }; 4 };
@@ -9,9 +10,7 @@ class CacheAdapter { @@ -9,9 +10,7 @@ class CacheAdapter {
9 constructor(dbName) { 10 constructor(dbName) {
10 this.dbName = dbName; 11 this.dbName = dbName;
11 if (dbName === DbTypes.DEF) { 12 if (dbName === DbTypes.DEF) {
12 - let DbType = require('./defaultCache');  
13 -  
14 - this.db = new DbType(); 13 + this.db = new DefaultCache();
15 } 14 }
16 } 15 }
17 get(key) { 16 get(key) {
1 -const page = r => require.ensure([], () => r(require('./#{pageName}')), '#{moduleName}.#{pageName}');  
2 -  
3 export default { 1 export default {
4 path: '/#{pageName}.html', 2 path: '/#{pageName}.html',
5 name: '#{pageName}', 3 name: '#{pageName}',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "#{moduleName}.#{pageName}" */'./#{pageName}'),
7 meta: { 5 meta: {
8 pageName: '新建页面' 6 pageName: '新建页面'
9 } 7 }
1 -const page = r => require.ensure([], () => r(require('./#{pageName}')), '#{moduleName}.#{pageName}');  
2 -  
3 export default { 1 export default {
4 path: '/#{pageName}.html', 2 path: '/#{pageName}.html',
5 name: '#{pageName}', 3 name: '#{pageName}',
6 - component: page, 4 + component: () => import(/* webpackChunkName: "#{moduleName}.#{pageName}" */'./#{pageName}'),
7 meta: { 5 meta: {
8 pageName: '新建页面' 6 pageName: '新建页面'
9 } 7 }
@@ -64,11 +64,12 @@ @@ -64,11 +64,12 @@
64 "request-promise": "^4.2.0", 64 "request-promise": "^4.2.0",
65 "serve-favicon": "^2.4.2", 65 "serve-favicon": "^2.4.2",
66 "uuid": "^3.0.1", 66 "uuid": "^3.0.1",
67 - "vue": "^2.2.2", 67 + "vue": "^2.3.4",
68 "vue-cookie": "^1.1.4", 68 "vue-cookie": "^1.1.4",
69 "vue-html5-editor": "^1.1.1", 69 "vue-html5-editor": "^1.1.1",
70 - "vue-router": "^2.2.0",  
71 - "vue-template-compiler": "^2.2.6", 70 + "vue-loader": "^11.3.4",
  71 + "vue-router": "^2.5.3",
  72 + "vue-template-compiler": "^2.3.4",
72 "xlsx2json": "^1.0.0", 73 "xlsx2json": "^1.0.0",
73 "yoho-cookie": "^1.2.0", 74 "yoho-cookie": "^1.2.0",
74 "yoho-md5": "^2.0.0", 75 "yoho-md5": "^2.0.0",
@@ -82,10 +83,11 @@ @@ -82,10 +83,11 @@
82 "autoprefixer": "^6.7.2", 83 "autoprefixer": "^6.7.2",
83 "autoprefixer-loader": "^3.2.0", 84 "autoprefixer-loader": "^3.2.0",
84 "babel-core": "^6.22.1", 85 "babel-core": "^6.22.1",
85 - "babel-eslint": "^7.1.1", 86 + "babel-eslint": "^7.2.3",
86 "babel-helper-vue-jsx-merge-props": "^2.0.2", 87 "babel-helper-vue-jsx-merge-props": "^2.0.2",
87 "babel-loader": "^6.2.10", 88 "babel-loader": "^6.2.10",
88 "babel-plugin-istanbul": "^3.1.2", 89 "babel-plugin-istanbul": "^3.1.2",
  90 + "babel-plugin-syntax-dynamic-import": "^6.18.0",
89 "babel-plugin-syntax-jsx": "^6.18.0", 91 "babel-plugin-syntax-jsx": "^6.18.0",
90 "babel-plugin-transform-object-rest-spread": "^6.23.0", 92 "babel-plugin-transform-object-rest-spread": "^6.23.0",
91 "babel-plugin-transform-runtime": "^6.22.0", 93 "babel-plugin-transform-runtime": "^6.22.0",
@@ -98,7 +100,7 @@ @@ -98,7 +100,7 @@
98 "clean-webpack-plugin": "^0.1.16", 100 "clean-webpack-plugin": "^0.1.16",
99 "css-loader": "^0.26.1", 101 "css-loader": "^0.26.1",
100 "escodegen": "^1.8.1", 102 "escodegen": "^1.8.1",
101 - "eslint": "^3.14.1", 103 + "eslint": "^3.19.0",
102 "eslint-config-standard": "^6.2.1", 104 "eslint-config-standard": "^6.2.1",
103 "eslint-config-yoho": "^1.0.8", 105 "eslint-config-yoho": "^1.0.8",
104 "eslint-friendly-formatter": "^2.0.7", 106 "eslint-friendly-formatter": "^2.0.7",
@@ -131,7 +133,7 @@ @@ -131,7 +133,7 @@
131 "url-loader": "^0.5.7", 133 "url-loader": "^0.5.7",
132 "vue-loader": "^11.1.4", 134 "vue-loader": "^11.1.4",
133 "vue-style-loader": "^2.0.0", 135 "vue-style-loader": "^2.0.0",
134 - "webpack": "^2.2.1", 136 + "webpack": "^2.6.1",
135 "webpack-dev-middleware": "^1.10.2", 137 "webpack-dev-middleware": "^1.10.2",
136 "webpack-dev-server": "^2.4.2", 138 "webpack-dev-server": "^2.4.2",
137 "webpack-hot-middleware": "^2.18.0", 139 "webpack-hot-middleware": "^2.18.0",