//获取应用实例
const app = getApp()
Page({
data: {
url:""
},
onShareAppMessage(options) {
//options.webViewUrl 可获得当前url
console.log(’/pages/index/index?url=’ + encodeURIComponent(options.webViewUrl));
var shareurl = ‘/pages/index/index?url=’ + encodeURIComponent(options.webViewUrl);
return {
title: ‘分享的title’,
imageUrl: ‘分享截图自定义’,
path: ‘/pages/index/index?url=’ + encodeURIComponent(options.webViewUrl),
success: function (res) {
// 转发成功
console.log(res)
wx.showToast({
title: ‘分享成功’,
icon: ‘success’,
duration: 2000
})
},
fail: function (res) {
// 转发失败
wx.showToast({
title: ‘分享失败’,
icon: ‘fail’,
duration: 2000
})
}
}
},
onLoad: function (options) {
var that= this
if (typeof (options.url) != “undefined”) {
that.setData({
url: decodeURIComponent(options.url)
})
} else {
that.setData({url: “https://www.mdj2001.com” });
return;
}
}
})
// wxml
<web-view src="{{url}}">web-view>
附图:1
这个里面的options.url始终是undefind…
不知道代码哪里出了错,求官方爸爸解答,我看好多帖子都是同样的问题,是不是bug,