小程序默認(rèn)分享
onLoad(option) {
uni.showShareMenu({
menus: ['shareAppMessage', 'shareTimeline'], // 需要顯示的轉(zhuǎn)發(fā)按鈕名稱列表.合法值包含 "shareAppMessage"、"shareTimeline"
success(res) {
console.log(res);
},
fail(e) {
console.log(e);
},
});
},
自定義分享
用戶點(diǎn)擊分享按鈕的時(shí)候會調(diào)用。這個(gè)分享按鈕可能是小程序右上角原生菜單自帶的分享按鈕,也可能是開發(fā)者在頁面中放置的分享按鈕(<button open-type="share">);
<button open-type="share">分享</button>
export default {
data() {},
// 分享好友
onShareAppMessage(res) {
if (res.form === 'button') {
// 自己想分享的內(nèi)容
}
// 默認(rèn)右上角的
return {
};
console.log(res, '====???');
},
// 分享朋友圈
onShareTimeline(res){
注意:只有定義了此事件處理函數(shù),右上角菜單才會顯示“分享到朋友圈”按鈕自定義轉(zhuǎn)發(fā)內(nèi)容
用于自定義分享內(nèi)容,不支持自定義頁面路徑
}
}
自定義的傳參文章來源地址http://www.zghlxwxcb.cn/news/detail-790819.html
文章來源:http://www.zghlxwxcb.cn/news/detail-790819.html
到了這里,關(guān)于uni-app小程序自定義分享內(nèi)容的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!