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

How to share mini program to Moments

王林
Release: 2021-01-25 09:17:23
forward
3632 people have browsed it

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(){
    
  }
  
})
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template