参考了https://segmentfault.com/q/1010000015962729?utm_source=tag-newest

funcAsync () {
      // fetch data
      return this.$axios.post('')
    }

    funcDoSomeThing () {
      this.funcAsync().then(res => {
          // do some thing
      })
    }

 

methods: {
    async funA(){
        var res =  await axios.post('')//这里的res就是你axios请求回来的结果了
    }
}
Logo

OpenTiny 是企业智能前端开发解决方案,以生成式 UI 和 WebMCP 两大自主核心技术为基础,加速企业应用的智能化改造。我们会在社区定期为大家分享一些前后端的技术文章。

更多推荐