從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小程序攜帶的對象


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM