从A小程序跳转到B小程序

从A小程序跳转到B小程序:

A小程序 wxml:

<navigator target="miniProgram" open-type="navigate" app-id="wx82b7c63d360a3b10" path="pages/personal/personal" extra-data="{{dataList}}" version="release" /> 

注释:json

1. app-id 设置要跳转的小程序的APPID 2. path 配置跳转后进入的页面 3. extra-data 能够设置要携带的数据,该参数是一个对象 4. version是要打开的小程序版本,有效值: develop(开发版),trial(体验版),release(正式版),仅在当前小程序为开发版或体验版时此参数有效;若是当前小程序是正式版,则打开的小程序一定是正式版。

A小程序 app.json:

{
  "navigateToMiniProgramAppIdList": [ "wx82b7c63d360a3b10" ] } 

B小程序经过在onload函数或者onShow函数中能够接收到,经过路径或者extra-data携带过来的参数小程序

B小程序app.js:

onShow: function (options) {
    console.log(options)
    console.log(options.referrerInfo)
    if (options.referrerInfo) { if (options.referrerInfo.extraData) { this.data.lotteryId = options.referrerInfo.extraData.id //获取共享抽奖派发的代金券id if (options.referrerInfo.extraData.type == 2) { this.data.lotteryVoucherId = options.referrerInfo.extraData.vouchersId } //获取共享抽奖派发的搜城币数量 if (options.referrerInfo.extraData.type == 5) { this.data.lotteryNumber = options.referrerInfo.extraData.number } } } }, 

options.referrerInfo.extraData则是A小程序携带的对象app

相关文章
相关标签/搜索