End.

nuxt项目接口请求

请求多个接口

const [news, exhibitionList] = await Promise.all([
  // 新闻接口
  this.$api.getInfo(),
  this.$api.login({ username: 'sss' })
])

console.log('news', news)
console.log('exhibitionList', exhibitionList)



单个

const rr = await this.$api.getInfo()
console.log('rr', rr)


单个

await this.$api.getInfo().then(rr => {
  console.log('rr', rr)
})
End.