微信上传图片ios不能调和Android能调上传接口的bug

本文描述了在微信公众号开发中遇到的iOS设备上传接口无法显示的问题,揭示了url配置差异导致的bug,并提供了修复方案,确保了在不同设备上的一致性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述:做微信公众号的时候发现iso不能显示,andriod里能正常调上传接口?

最后发现是url不一样

   // 微信config配置
    initConfig() {
      let _this = this;
      let url = "";
      // 判断是否是ios微信浏览器
      if (window.__wxjs_is_wkwebview === true) {
        url = this.$store.state.url.split("#")[0];
      } else {
        url = window.location.href.split("#")[0];
      }
      $ajax(
          "/getConfig",//获取配置信息的接口(后端给的)
          {url: url},  //传给后端的data
          "wexin"
        )
        .then(res => {
          // alert(JSON.stringify(res));
          _this.$wx.config({
            debug: false,
            appId: res.data.appid,
            timestamp: res.data.timestamp,
            nonceStr: res.data.nonceStr,
            signature: res.data.signature,
            jsApiList: [
              "chooseImage",
              "previewImage",
              "uploadImage",
              "downloadImage"
            ]
          });
        });
    },

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值