小程序 web-view 转发后打开空白
发布于 7 年前 作者 juan94 2314 次浏览 来自 问答
onLoad: function (options) {
      var url = decodeURIComponent(options.url);
      this.setData({
          web_src: url,
      });
  },

wxml:

<web-view src="{{web_src}}" bindmessage="bindGetMsg"></web-view>
bindGetMsg: function (e) {
      var that = this
      that.setData({
          title: e.detail.data[0].tit,
          imageUrl: e.detail.data[0].thumb,
          web_src: e.detail.data[0].url,
          share_path: 'pages/wedding/wedding?url=' + encodeURIComponent(e.detail.data[0].url)
      });
  },

转发出去打开空白 是什么问题呢?

3 回复

用了encodeURIComponent转发后的url有问题,试下去掉encodeURIComponent,或者 var url = decodeURIComponent(options.url);要decode2次,转发时候好像会被微信再encode一次

看看转发后的 wxml 面板上是不是你要的页面咯。

回到顶部