zoukankan      html  css  js  c++  java
  • 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);
  • 相关阅读:
    es删除索引
    真人快打11技能键位
    点到线段的距离
    行列快乐值
    按钮变色
    取数求和
    机器分配
    田忌赛马 问题
    雷达
    最小字典序
  • 原文地址:https://www.cnblogs.com/victorlyw/p/11364237.html
Copyright © 2011-2022 走看看