h5在微信中自定义分享内容
请求接口 返回appid, nonceStr, timestamp,signature,
wx.config({
debug: false,//调试模式为true
appId: appId,
nonceStr: nonceStr,
timestamp: timestamp,
signature: signature,
jsApiList: [
"updateTimelineShareData",
"updateAppMessageShareData",
"onMenuShareTimeline",
"onMenuShareAppMessage"
]
});
if (typeof wx != "undefined") {
wx.ready(() => {
//分享朋友
wx.updateAppMessageShareData({
title: shareTitle,
desc: shareContent,
link: shareLink,
imgUrl: url, //分享图标
success: () => {
this.doShareDone();
},
cancel: () => {
this.doShareCancel();
}
});
//分享到朋友圈
wx.updateTimelineShareData({
title: this.shareTitle,
desc: this.shareContent,
link: this.shareLink,
imgUrl: url, //分享图标
success: () => {
this.doShareDone();
},
cancel: () => {
this.doShareCancel();
}
});
});
}