processing asynchronous operations async

async async function is used as a key, try and catch to handle the exception, await receiving a promise function returns

async list () {
      try {
        await api.findjuBarData().then(res => {
          console.log(res)
        })
        the console.log ( 'Test')
      } catch (error) {
        console.log(error)
      }
    },

This function prints the print request to another value 'test'

Guess you like

Origin www.cnblogs.com/wjsy/p/12048016.html