欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

微信小程序分享的朋友圈

程序员文章站 2022-07-03 17:56:19
上图注意事项、1、onLoad中声明: wx.showShareMenu({ withShareTicket: true, menus: ['shareAppMessage', 'shareTimeline'] }); 2、要有onShareAppMessage,并return。3、不是web-view页面。4、要有onShareTimeline,并return。5、把小程序工具基础库调到2.11.3以上。6、内测阶段仅部分机型的bate版本微信可以...

上图微信小程序分享的朋友圈
微信小程序分享的朋友圈
微信小程序分享的朋友圈
注意事项、
1、onLoad中声明:

 wx.showShareMenu({
      withShareTicket: true,
      menus: ['shareAppMessage', 'shareTimeline']
    });   

2、要有onShareAppMessage,并return。
3、不是web-view页面。
4、要有onShareTimeline,并return。
5、把小程序工具基础库调到2.11.3以上。
6、内测阶段仅部分机型的bate版本微信可以真机测试。

具体实现代码

onLoad: function (options) {
 wx.showShareMenu({
      withShareTicket: true,
      menus: ['shareAppMessage', 'shareTimeline']
    });  
    }
var that = this
if (res.from === 'button') {}
return {
  title: '注册自己的服装定制小程序吧~~',
  path: '/pages/mall/xxxxx/xxxxx?id=' + that.data.goodId,
  success: function (res) {
    console.log('转发成功', res)
  }
}
onShareTimeline: function () {
var that = this
	return {
      title: '定制属于自己的服装',
      query: 'id=' + that.data.goodId,
      imageUrl: 'https://www.xxxxxx.cn/xxx/xxx/202004/004152026453oux.jpg'
    }
},

本文地址:https://blog.csdn.net/u010481239/article/details/107324992