第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

es6函數(shù)的.then中無法return結(jié)果

es6函數(shù)的.then中無法return結(jié)果

德瑪西亞99 2019-03-01 20:33:23
export function postMethod(data) {  const baseURL = process.env.BASE_API   axios({     method: 'post',     url: baseURL + '/img_upload',     timeout: 50000,     data: data,     headers: {      'loginToken': getLoginToken()     }   }).then(res => {    const respose = res.data    if (respose.errno == 'success') {  //成功       //console.log(respose.data)       //******************此處返回((((((((((((((((       return respose.data      //******************此處返回))))))))))))))))     } else if (respose.errno == 'fail') {  //失敗       Message({         message: respose.msg,        type: 'error',         duration: 2 * 1000       })     } else { //登錄失敗       Message({         message: '登錄失敗',        type: 'error',         duration: 2 * 1000       })     }   }) }在別處使用postMethod(data)時,結(jié)果是undefined。這個return沒起作用,如何讓函數(shù)返回調(diào)取接口時返回的數(shù)據(jù)?
查看完整描述

2 回答

?
繁星coding

TA貢獻1797條經(jīng)驗 獲得超4個贊

return axios....

postMethod(data).then(resposeData=>{
    ...
})


查看完整回答
反對 回復(fù) 2019-03-01
?
一只萌萌小番薯

TA貢獻1795條經(jīng)驗 獲得超7個贊

export function postMethod(data) {  const baseURL = process.env.BASE_API  return axios(...)


查看完整回答
反對 回復(fù) 2019-03-01
  • 2 回答
  • 0 關(guān)注
  • 2510 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號