await后面調用方法,方法內部有ajax請求,為何不是等方法內部的請求結束再往下執行?怎么解決? (async ()=>{ await this.getDetailHttp(); console.log(2222) //希望在getDetailHttp內部的ajax請求結束后再執行
})();
getDetailHttp(){ this.$fetch( 'maintain/single/detail/' + this.checkObj.id
).then(res=>{ if(res.data.status === 200){ console.log(111)
};
})
}
async await 執行順序
Smart貓小萌
2018-11-17 16:58:12