Home >WeChat Applet >Mini Program Development >How to share mini program to Moments

How to share mini program to Moments

王林
王林forward
2021-01-25 09:17:233629browse

How to share mini program to Moments

Good news:

2020-07-07, the mini program starts to support sharing to Moments (only available on Android phones).

(Learning video sharing: Introduction to Programming)

Test model: Xiaomi 9 miui12 20.7.2 WeChat version 7.0.16

Experience address: Scan the QR code to enter the mini program----Click the three dots in the upper right corner

Technical Official Account

How to share mini program to Moments

Look at the case first

How to share mini program to Moments

How to share mini program to Moments

WeChat development documentation:

https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability /share-timeline.html

https://developers.weixin.qq.com/miniprogram/dev/reference/api/Page.html#onShareTimeline

https://developers.weixin .qq.com/miniprogram/dev/api/share/wx.showShareMenu.html

Code

//index.js
//获取应用实例
const app = getApp()
 
Page({
  data: {
    
  },
  
  onLoad: function () {
   
    wx.showShareMenu({
      menus: ['shareAppMessage', 'shareTimeline'],
      success(res) {
        console.log(res)
      },
      fail(e) {
        console.log(e)
      }
    })
    
  },
  
  onShareAppMessage(){
    
  },
  onShareTimeline(){
    
  }
  
})

My WeChat LJT-917

Related recommendations: Mini program development tutorial

The above is the detailed content of How to share mini program to Moments. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete