学习路上的小刘 2021-12-24 13:52 采纳率: 66.7%
浏览 117

uni-app H5端 中的uni.request 在手机端的百度浏览器 报错 有些接口报 request: fail

uni-app H5端 中的uni.request 在手机端的百度浏览器 报错 有些接口报 request: fail

问题相关代码
    request(url, method = 'GET', data = {}, success, fail) {
        return new Promise((resolve, reject) => {
            if (isShowLoad) {
                uni.showLoading({
                    title: "加载中...",
                    mask: true
                })
            }
            uni.request({
                method: method,
                url: url,
                data: data,
                header:{'Content-Type':'application/x-www-form-urlencoded'},
                dataType:"json",
                success: (res) => {
                    if(this.checkResponse(res,url)){
                        success(res.data);
                    }else{
                        fail(res);
                    }
                    
                },
                fail: (err) => {
                    uni.showModal({
                        title: '提示',
                        content: JSON.stringify(err),
                        showCancel: false,
                    });
                    fail(err);
                },
                complete: () => { 
                    try {
                        setTimeout(()=>{uni.hideLoading();},300)
                        
                    } catch (e) {
                        //TODO handle the exception
                    }

                }
            })
        })
    }

调用获取轮播图接口的时候 报错
request: fail
但是在其他浏览器没有这个问题,百度浏览器上有时可以有时又不行

我想要达到的结果

能够正常调用请求

  • 写回答

1条回答 默认 最新

  • 你好!机器人 2021-12-24 14:12
    关注

    改成false试试

    img

    评论

报告相同问题?

问题事件

  • 创建了问题 12月24日

悬赏问题

  • ¥15 c++ gmssl sm2验签demo
  • ¥15 关于模的完全剩余系(关键词-数学方法)
  • ¥15 有没有人懂这个博图程序怎么写,还要跟SFB连接,真的不会,求帮助
  • ¥30 模拟电路 logisim
  • ¥15 PVE8.2.7无法成功使用a5000的vGPU,什么原因
  • ¥15 is not in the mmseg::model registry。报错,模型注册表找不到自定义模块。
  • ¥15 安装quartus II18.1时弹出此error,怎么解决?
  • ¥15 keil官网下载psn序列号在哪
  • ¥15 想用adb命令做一个通话软件,播放录音
  • ¥30 Pytorch深度学习服务器跑不通问题解决?