鍍金池/ 問答/HTML5  HTML/ 如何獲取await 返回值

如何獲取await 返回值

想要達成這樣一種效果

async getInfo(id) {
    let params = {
         id
     }
      let res = await getdeviceInfo(params);
       return res.data
      }

然后可以通過

console.log(getInfo) 直接拿到返回值,而不是通過then方法來調(diào)用獲取返回值

回答
編輯回答
敢試

(async ()=>{console.log(await getInto(id));})()

2018年7月28日 12:54
編輯回答
筱饞貓

await getinfo(id)或者getinfo(id).then(e=>e)

2017年9月25日 20:10