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

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

A小程序 wxml:

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

注释:

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小程序携带的对象

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

春哥111

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值