当多个接口调用,后面的接口须要使用前面接口返回的数据时,咱们须要用到 .then()的写法,以下:html
let _this = this; //接口10,获取数据分组 dispatch({ type: 'resourceMonitor/queryHistoryTopMetricsGroup', payload: '49', }).then(function() { //接口4,获得级联框中的全部数据 dispatch({ type: 'resourceMonitor/queryVisibleScope', payload: { customIdList, projectIdList, sysInstanceIdList, }, }).then(function() { //接口5,获取运行状况排名的各列的颜色配置信息 dispatch({ type: 'resourceMonitor/querySaleDayStatsMetricsDefine', payload: '49', }); //接口9:获取运行状况每一个表格对应的数据 _this.getTopAndBottomData(dispatch, _this.state.salesType, _this.props); }); });