dvaJS Model之间的调用


 

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);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM