Home >WeChat Applet >Mini Program Development >How to perform forwarding operations within the mini program page

How to perform forwarding operations within the mini program page

王林
王林forward
2021-02-24 10:11:443801browse

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.net. If there is any infringement, please contact admin@php.cn delete