Authored by 陈峰

router

/**
* Created by TaoHuang on 2017/4/26.
*/
const editProduct = r => require.ensure([], () => r(require('./edit')), 'product.create');
const editProduct = r => require.ensure([], () => r(require('./edit')), 'product.edit');
export default {
path: '/edit/:id.html',
... ...
... ... @@ -2,7 +2,7 @@ const allotList = r => require.ensure([], () => r(require('./allot-list')), 'tra
export default {
path: '/allotList.html',
name: 'allotList',
name: 'allotlist',
component: allotList,
meta: {
pageName: '调拨单'
... ...
... ... @@ -2,6 +2,6 @@ const printDetail = r => require.ensure([], () => r(require('./print-detail')),
export default {
path: '/printDetail.html',
name: 'printDetail',
name: 'printdetail',
component: printDetail
};
... ...
... ... @@ -9,14 +9,17 @@ export default {
if (_.has(rous, 'path')) {
let ps = _.flattenDeep(paths).filter(p => p);
rous.name = _.join(ps, '.');
if (_.last(ps) === rous.name) {
ps = _.dropRight(ps);
}
if (!children) {
if (rous.path) {
rous.path = _.join(_.dropRight(ps, 1), '/') + (rous.path[0] === '/' ? '' : '/') + rous.path;
rous.path = _.join(ps, '/') + (rous.path[0] === '/' ? '' : '/') + rous.path;
} else {
rous.path = _.join(ps, '/') + '.html';
}
}
rous.name = _.join(_.concat(ps, [rous.name]), '.');
if (rous.children) {
_.each(rous.children, child => this.loadRouters(child, [paths, child.name], true));
... ... @@ -26,7 +29,7 @@ export default {
}
if (rous.length) {
return _.map(rous, r => {
return this.loadRouters(r, [paths, r.name]);
return this.loadRouters(r, [paths]);
});
} else {
return _.map(rous, (rou, k) => {
... ...