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

增加模块页面跳转的钩子

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