Wechat mini program was quietly launched on Tuesday, July 7, with the function of sharing to moments, which is still in beta.

At present, there are the following two restrictions on sharing applets in moments:

A. Only Android is supported. Ios is not supported

B. Limit 2.11.3 or above of wechat basic library


  1. Wx.showsharemenu (), support quick sharing to moments using the default applets title, sharing picture applets logo, can not be customized parameters. (Uni-app supported)
wx.showShareMenu({
  menus: ['shareAppMessage'.'shareTimeline'] //shareAppMessage must be present
})
Copy the code
  1. OnShareTimeline () : supports the customization of the title of the applets shared to the moments, the sharing image, and the customization of query parameters. (Uni-app is not supported until the release date)
// Note that "send to friends" onShareAppMessage must be set, which is the premise of setting onShareAppMessage. Otherwise, sharing to moments is not supported
onShareAppMessage: (a)= >{},onShareTimeline: (a)= > {
  return {
    title: "Test applet moments to share".query: "id=110101&name=heyzqt".imageUrl: "https://example.cn/test.png"}},Copy the code

Single page mode

Users in moments to open the sharing of small program page, although it is a page in the small program, but will not really open the small program, can be understood as only to preview a single page.

In this single-page mode, the navigation bar is fixed at the top and the action bar is fixed at the bottom, which cannot be customized. Therefore, adaptation should be considered.

The default preview is the content of the current applet, but some components or interfaces in single-page mode have limitations, such as no login status, wx.login is unavailable, cannot jump to other pages, cannot landscape, does not render tabBar, local storage is not shared with the applet in normal mode.

Therefore, in some interactive operations, a toast message may pop up asking you to go to the mini program to use the complete service. Therefore, wechat official suggests that sharing moments should be used in the case of pure content sharing.

Recently wechat official also have a lot of positive actions for small programs, such as H5 jump small program began public test, enterprise red envelope cover story jump small program, are very interesting, we can pay attention to.

More details can be found in the wechat developer document sharing mini program to moments

If it is helpful to you, the likes, comments and favorites are all encouragement to me and motivation to support me to write further. Thank you!

This article was originally published in the wechat public number “Programmer Zhang Qingtian”, welcome to pay attention to the first time to get the latest share, together with progress.