foreword
Official document: https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
For the applet that has not set the function of sharing the circle of friends, the button of sharing circle of friends is gray and cannot be clicked, as shown in the following figure:
If the Mini Program page has the Share Moments function enabled, it is available, as shown in the following figure:
1. Turn on the function
On the page where you want to enable the function of sharing circle of friends, call
wx.showShareMenu()
Open , and the button of sharing circle of friends will be activated (from gray to available), as shown in the figure above.
Open the *.js
file onLoad
and add the following code to the life cycle:
// index.js