web-view分享网页,传递过来的参数通过bindmessage接收到网页title,方法如下
bindmessage(e) {
this.setData({//存储状态
title: e.detail.data
})
}
,
onShareAppMessage(options) {
var that = this;
var utitle = that.data.title[0].bind;
return {
title: utitle,
path: ‘/pages/index/index?url=’ + encodeURIComponent(options.webViewUrl),
success: function (res) {
},
fail: function (res) {
// 转发失败
}
}
}
但是目前是先执行onShareAppMessage,所以导致bindmessage接收到网页title,无法在onShareAppMessage中显示。每次进行分享的标题 都是上一次传递的参数,应该如何解决?