用redux工具查看每个路由下的状态,状态都是对应model里面的状态,如果我要用其他model里的状态,怎么获取啊
effects里面的Generator函数里面可以获得select函数,select函数能获取整个store里面的state。例子:
*getUserList(action, { call, put, select }) {
yield put({
type: 'changeLoading',
payload: true,
});
const query = yield select(state => state['UserManage/UserList'].query);
console.log(query);
const res = yield call(UserListService.getUserList, query);
yield put({
type: 'getUserListReducer',
payload: res.data,
});
},
太好了,就是她
Most helpful comment
effects里面的Generator函数里面可以获得select函数,select函数能获取整个store里面的state。例子: