1. 程式人生 > >微信上傳圖片ios不能調和Android能調上傳介面的bug

微信上傳圖片ios不能調和Android能調上傳介面的bug

問題描述:做微信公眾號的時候發現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"
            ]
          });
        });
    },