标签:mod ret amp callback cal return script sel bsp
const Model: ModelType = { namespace: ‘namesps‘, state: { data: {} }, effects: { *fetch({ payload, callback }, { call, put, select }) { const res = yield call(queryApplyInvoiceInfo, payload); if (!res || !res.data) return; const total = yield select((state) => state.user.currentUser ) console.log(total); yield put({ type: ‘change‘, payload: res }) if (callback) callback(); } }, reducers: { change (state, { payload }) { return { data: (state && state.data) || { list: [], pagination: {} } } } } }; export default Model;
// 选择 state + ‘全局属性名(namespace)‘ + state属性名
const total = yield select((state) => state.user.currentUser )
console.log(total);
标签:mod ret amp callback cal return script sel bsp
原文地址:https://www.cnblogs.com/victorlyw/p/11364237.html