8***@qq.com
8***@qq.com
  • 发布:2020-07-14 18:14
  • 更新:2020-07-15 10:24
  • 阅读:4902

uni-app 如何实现 同步请求?async+await 还是不行

分类:uni-app

uniapp 如何实现同步请求?请求走完在进行下一步 , 用了 async 和 await 还是不行 还是异步了; 代码如下:


            this.getSwiper();  
            console.error('333333333333333333333333333333');  

        },  
        async getSwiper() {  
            console.log('11111111111111111111111111111111111');  
            const res = await this.$ApiHttpGet('https://unidemo.dcloud.net.cn/api/news', {});  
            console.log('222222222222222222222222222');  
            return res;  
        } ```   
这 运行顺序应该是  111,222, 333    但运行顺序是  111、 333、 2222  
2020-07-14 18:14 负责人:无 分享
已邀请:
uniapp追随者

uniapp追随者

await this.getSwiper()

  • 8***@qq.com (作者)

    嗯嗯 解决了 谢谢

    2020-07-15 10:50

  • 1***@qq.com

    回复 8***@qq.com: 怎么解决的,我怎么不行

    2022-01-10 22:51

  • 過愙

    回复 8***@qq.com: 请问你这个是如何解决的

    2022-10-28 11:41

该问题目前已经被锁定, 无法添加新回复