use async await,await "s function log to print out the data, but the async function cannot get the value, and first print out that undefined, is printing out the data
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
}