vue的項(xiàng)目中現(xiàn)在有這兩個方法,有個C方法,需要在這兩個異步請求的方法完成后才執(zhí)行,要怎么寫,新手求問,這兩個方法都使用了es6的promise 和 axios這個庫created() { this._getChannelList() this._getRecentContact()},method: { _getChannelList() { getChannelList(this.getCookie('sender'), this.getCookie('version')).then(res => { // 成功 }).catch(err => { console.log(err) }) }, _getRecentContact() { getRecentContact(this.getCookie('sender')).then(res => { // 成功 }).catch(err => { console.log(err) }) }, c() { // 需要在上面兩個方法都請求完畢才執(zhí)行 }}
所有異步請求完成后的回調(diào)
慕運(yùn)維8079593
2019-03-14 11:15:51