Problems encountered in using async await in vue

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 
      }

Mar.31,2021

there is no return value in your getRechargeOrder () . Of course, it is undefined . The correct thing to do is to getRechargeOrder () return a Promise , and trigger resolve

when you get the data.
getRechargeOrder() {
  return new Promise((resolve, reject) => {
    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)}
          resolve(data);
        }
      }
    }).catch(error => {
      reject(error)
    })
  })
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d9df-2c3b0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d9df-2c3b0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?