當多個接口調用,後面的接口須要使用前面接口返回的數據時,咱們須要用到 .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); }); });