微信小程序开发之转发分享功能

网友投稿 402 2023-11-07

官网文档:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html

微信小程序开发之转发分享功能

第一种情况 点击小程序转发

不加入参数

?
1
2
3
4
5
6
7
8
9
10
//转发
onShareAppMessage: function() {
let users = wx.getStorageSync(user);
if (res.from === button) {}
return {
title: 转发,
path: /pages/index/index,
success: function(res) {}
}
}

加入参数

?
1
2
3
4
5
6
7
8
9
10
//转发
onShareAppMessage: function() {
let users = wx.getStorageSync(user);
if (res.from === button) {}
return {
title: 转发,
path: /pages/index/index?from_uid= + users.id,
success: function(res) {}
}
}

第二种 分享

这个分享必须做成button 且加上 open-type="share"

不加入参数

加入参数 

?
1
2
3
4
5
6
7
8
9
10
11
12
13
//转发
onShareAppMessage: function (res) {
if (res.from === button) {
}
return {
title: 转发,
path: /pages/index/community/topic/topic?jsonStr= + this.data.list,
success: function (res) {
console.log(成功, res)
}
}
}

提醒:

这里转发的参数要在onLoad 的options 运用

总结

以上所述是小编给大家

如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
您可能感兴趣的文章:微信小程序前端自定义分享的实现方法微信小程序生成海报分享朋友圈的实现方法微信小程序实现的自定义分享功能示例微信小程序实现分享朋友圈的图片功能示例微信小程序通过uni-app进行全局分享

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:今日头条小程序是什么?
下一篇:详解微信小程序入门从这里出发(登录注册、开发工具、文件及结构介绍)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~