1、小程序分享轉(zhuǎn)發(fā)(法一)
a:右上角菜單欄顯示轉(zhuǎn)發(fā)
wx.showShareMenu({
withShareTicket: true,
success: function(res) {
},
fail: function(res) {
}
})
b:
onShareAppMessage(options) {
let shareObj = {
title: '精選優(yōu)惠券',
path: '/pages/selected', // 默認(rèn)當(dāng)前頁(yè)的url
imageUrl: '../images/logo.png',
success: function(res) {
console.log(res, '成功')
},
fail: function(res) {
console.log(res, '失敗')
}
}
return shareObj
}
2、小程序分享轉(zhuǎn)發(fā)(法二)
a:自定義轉(zhuǎn)發(fā)分享
<button data-name="shareBtn" open-type="share">轉(zhuǎn)發(fā)</button>
b:
onShareAppMessage(options) {
let shareObj = {
title: '精選優(yōu)惠券',
path: '/pages/selected', // 默認(rèn)當(dāng)前頁(yè)的url
imageUrl: '../images/logo.png',
success: function(res) {
console.log(res, '成功')
},
fail: function(res) {
console.log(res, '失敗')
}
}
if(option.form === 'button'){
var eData = options.target.dataset;
console.log( eData.name );
}
return shareObj
}