苹果手机webview分享参数丢失
发布于 5 年前 作者 hejun 8236 次浏览 来自 问答

苹果手机webview分享,option.

webViewUrl链接参数会丢失,不完整(例如:pages/pcweb/pcweb?shareUrl= https://m.sanfu.com/goods/goodsDisplay?goods_sn=296614)【goods/goodsDisplay?goods_sn=296614】参数丢失,安卓手机不会

@那个很帅的小白

3 回复

问题在于你app.json里声明的页面地址是index/index,但分享地址填写的却是pages/index/index。两处保持一致即可。

提供下相关的代码片段,我测试下

/**

  * 用户点击右上角分享

  */

onShareAppMessage: function (options) {

let that = this

let return_url = options.webViewUrl

var path = ‘/pages/sharepage/sharepage?shareUrl=’ + encodeURIComponent(return_url)

return {

title: ‘测试分享’,

path: path,

success: function (res) {

that.setData({

web_src: decodeURIComponent(options.webViewUrl)

})

},

fail: function (res) {

// 转发失败

}

}

onLoad: function (options) {

that.setData({

web_src: decodeURIComponent(options.shareUrl)

})

}

ctxPath: 'https://m.sanfu.com/goods/goodsDisplay?goods_sn=296614’为要转发的链接

回到顶部