提交 2a832840 authored 作者: vipcxj's avatar vipcxj

增加模块页面跳转的钩子

上级 719770f4
......@@ -125,7 +125,8 @@ const createRoutes = async (app, modules, groups, basePath) => {
let modelBundle;
if (layout.route) {
modelBundle = await import(`./models/main/modules/${layout.route}`);
registerModel(app, modelBundle.default);
modelBundle = modelBundle.default;
registerModel(app, modelBundle);
let routeBundle = await import(`./routes/main/modules/${layout.route}`);
routeBundle = routeBundle.default || routeBundle;
route.component = routeBundle;
......@@ -145,10 +146,10 @@ const createRoutes = async (app, modules, groups, basePath) => {
if (modelBundle) {
model = {};
model.namespace = modelBundle.namespace;
model.reducerEnterHook = !!model.reducers['@@enter'];
model.effectEnterHook = !!model.effects['@@enter'];
model.reducerExitHook = !!model.reducers['@@exit'];
model.effectExitHook = !!model.effects['@@exit'];
model.reducerEnterHook = modelBundle.reducers && !!modelBundle.reducers['@@enter'];
model.effectEnterHook = modelBundle.effects && !!modelBundle.effects['@@enter'];
model.reducerExitHook = modelBundle.reducers && !!modelBundle.reducers['@@exit'];
model.effectExitHook = modelBundle.effects && !!modelBundle.effects['@@exit'];
}
if (route.onEnter) {
const onEnter = route.onEnter;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论