Promise的链式调用,和axios处理高并发
axios.get( api1 ).then( d1 ){return axios.get( api2 )}.then( d2 ){return axios.get( api3 )}.then ( d3 ){return axios.get( api4 )}
与下面的有什么不同
axios.get( api ).then( data ){return new Promise((res,rej)=>{axios.get( api2 ).then ( data2 ){res(data2)}})}.then( data3 ){console.log( data3)}
自己的答案
多创建了个Promise对象
可以先处理数据,再把返回的处理好的数据
