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

王林
Release: 2021-02-24 10:11:44
forward
3799 people have browsed it

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

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

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

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

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!

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