UNPKG

wiz-frameworks

Version:

wizlong react framework

40 lines (32 loc) 2.43 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); 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; }; var _core = require('./core'); 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 */ 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 (0, _core.createRoute)(app, function (app) { return _extends({ path: app[key].path, title: app[key].title, component: (0, _core.dynamicWrapper)(app, app[key].model, function () { return app[key].component; }) }, other); }); }; exports['default'] = function (app, conf) { return create(app, conf); }; module.exports = exports['default'];