1. Disable sharing
onLoad (option) {
wx.hideShareMenu({
success: function () {
console.log("成功隐藏分享按钮")
},
fail: function () {
console.log("隐藏分享按钮失败")
}
})
}
2. Customized sharing
<button class="share-button" open-type="share"></button>
Add the open-type="share" attribute to the button tag, and automatically trigger the onShareAppMessage function in the page when the button is clicked.
onShareAppMessage() {
return {
title: '这是分享标题',
path: '分享路径',
imageUrl: '封面图' //如果封面图为空 自动取当前页面截图
}
}
If you only want to trigger sharing when clicking the button, you can disable sharing in the upper right corner...
onLoad() {
wx.hideShareMenu({
menus: ["shareAppMessage"]
})
}