search
HomeWeChat AppletMini Program DevelopmentHow to perform forwarding operations within the mini program page

How to perform forwarding operations within the mini program page

Let’s first take a look at the content of the official documentation:

The official documentation says that by setting the attribute open-type="share" to the button component, the user can The Page.onShareAppMessage event is triggered after clicking the button. Related components: button.

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

How to perform forwarding operations within the mini program page

How to perform forwarding operations within the mini program page

In the first case, click the mini program to forward

How to perform forwarding operations within the mini program page

How to perform forwarding operations within the mini program page

Do not add parameters

  //转发
  onShareAppMessage: function() {
    let users = wx.getStorageSync('user');
    if (res.from === 'button') {}
    return {
      title: '转发',
      path: '/pages/index/index',
      success: function(res) {}
    }
  }

Add parameters

  //转发
  onShareAppMessage: function() {
    let users = wx.getStorageSync('user');
   if (res.from === 'button') {}
    return {
      title: '转发',
      path: '/pages/index/index?from_uid=' + users.id,
      success: function(res) {}
    }
  }

Second type: Share

How to perform forwarding operations within the mini program page

##This sharing must be made into a button and open-type added ="share"

Do not add parameters

  onShareAppMessage: function (res) {
    if (res.from === 'button') {
    }
    return {
      title: '转发',
      path: '/pages/index/community/topic/topic',
      success: function (res) {
        console.log('成功', res)
      }
    }
  }

Add parameters


  //转发
  onShareAppMessage: function (res) {
    if (res.from === 'button') {
 
    }
    return {
      title: '转发',
      path: '/pages/index/community/topic/topic?jsonStr=' + this.data.list,
      success: function (res) {
        console.log('成功', res)
      }
    }
  }

How to perform forwarding operations within the mini program page

Reminder: The parameters forwarded here must be in onLoad Options application

How to perform forwarding operations within the mini program page

Related recommendations:

小program development tutorial

The above is the detailed content of How to perform forwarding operations within the mini program page. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools