asyncfunctiongetList(){returnawaitaxios({method:'post',url:'/list/tododata/',data:json}).then(res=>{returnaxios.get('/list/tododata',{params:{'page':newState.current,}}).then((res)=>{constdata=res.data;returndata.results//想獲取這個(gè)東西}).catch((error)=>{console.log(error);});}).catch((err)=>{console.log(err);});}getList().then(value=>{newState.list=value})returnnewStateasync返回的還是一個(gè)Promise,獲取Promise的值還是異步的,以至于最后return的newSate還是沒有被更新,請(qǐng)問(wèn)想要獲取最新的newState該怎么改?
在線等,挺急的!axios怎么實(shí)現(xiàn)同步機(jī)制感激不盡
有只小跳蛙
2019-08-09 23:50:03