Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

umi 如何传递 dva-loading createLoading options 信息 #1523

Closed
jrongbin opened this issue Nov 24, 2018 · 3 comments
Closed

umi 如何传递 dva-loading createLoading options 信息 #1523

jrongbin opened this issue Nov 24, 2018 · 3 comments

Comments

@jrongbin
Copy link

需求:
希望能配置 dva-loading 中的 except 信息,目的是移除一些我不期望的 loading 状态

原因:
我使用 effect 封装逻辑,执行过程中产生 loading 信息,state 发生变化,组件发生重新渲染。因此我想配置 dva-loading 的 except ,过滤掉一些我不希望产生 loading effect

查找过 issue 和 代码,目前不知道如何处理。

@jrongbin
Copy link
Author

最后我的做法是在 app.js 中,使用 onReducer 判断,完成了该变化。

@chenkuangkuang
Copy link

@jrongbin 求教具体怎么操作呢?

@chenkuangkuang
Copy link

我的处理方式:
onReducer: (reducer) => {
return (state, action) => {
// console.log('=state, acction=', state, action);
// 对于app/xxx 引发的loading 不触发state更新,避免全局loading引发的多余render
if (
action.type.includes('@@DVA_LOADING') &&
action.payload.actionType == 'app/xxx'
) {
console.log('=state, action=', state.loading, action);
return lastState;
}
lastState = reducer(state, action);
return lastState;
};
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants