小程序按钮分享、右上角分享、禁用
- 右上角分享只需在onShareAppMessage里配置路径信息即可
onShareAppMessage: function () {
let item = this.data.addList;
let address = item[0].address;
let houseId = this.data.houseId;
console.log(item);
return {
title: address, //标题
path: 'package-myHouses/pages/preview/preview?houseId=' + houseId//这是一个路径
}
}
- 按钮分享需在button加入 open-type=‘share’,然后在onShareAppMessage配置即可
<button open-type='share'>分享给我的好友</button>
禁用
onLoad: function (options) {
wx.hideShareMenu()
}
本文详细介绍了小程序中实现分享功能的方法,包括如何通过右上角菜单和按钮触发分享,以及如何禁用分享菜单。展示了具体的代码示例,如onShareAppMessage函数的配置,以及button标签的使用。
2794

被折叠的 条评论
为什么被折叠?



