小程序预览执行的错误,在微信工具上没问题?

我用的uniapp开发的,就下面的代码,也是这个页面内调的第一个接口,在微信工具上没什么问题,但是“预览”用手机,却提示下面的错误:

console.log('a')
                const res = await this.$http({
                    url: '/CollectionDoc/GetDocInfoById',
                    method: 'POST',
                    data
                }).catch(e=>{
                    console.log('b')
                    this.emptyLoading=false;
                    this.doctorData = {}
                })
                if (res.Code == 0) {
                    console.log('c')
                    this.doctorData=res.Data
                    this.emw=res.Msg
                    this.emptyLoading=false;
                }else{
                    console.log('d')
                    this.emptyLoading=false;    
                }

image.png
如果我把catch去掉,会提Code有问题,我怎么感觉是这个接口压根没有走呀?有人遇到过没?微信开发工具上正常。

阅读 659
1 个回答

小程序request合法域名添加了吗?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题