使用async await,await的函数log出了数据,但是async函数获取不到值,并且先打印出undefined,在打印出数据
getRechargeOrder () { let apiUrl = this.$api.URL.rechargeOrder this.$api.axiosGet(apiUrl, para).then(res => { if (res.data.code === 0) { let data = res.data.data if (data.payNum) { console.log(data)//{payTotal: 3344, payNum: 86, payPeopleNum: 65, list: Array(86)} return data } } }).catch(error => alert('error')) }, async getDau () { let res = await this.getRechargeOrder() console.log(res)//undefined }
互换的青春
相关分类