wiz-frameworks
Version:
wizlong react framework
34 lines (28 loc) • 1.2 kB
JavaScript
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
/**
*
* @overview 动态生成路由
* @author mll
* @date 2019-9-5
*/
import { dynamicWrapper, createRoute } from './core';
var create = function create(app, conf) {
var path = conf.path,
title = conf.title,
other = _objectWithoutProperties(conf, ['path', 'title']);
var key = path + '@' + title;
app[key] = conf;
return createRoute(app, function (app) {
return _extends({
path: app[key].path,
title: app[key].title,
component: dynamicWrapper(app, app[key].model, function () {
return app[key].component;
})
}, other);
});
};
export default (function (app, conf) {
return create(app, conf);
});