小程序跳轉傳參參數值為url時參數丟失


通過先encodeURIComponent,取到值以后再decodeURIComponent,拼接參數正常傳遞

A頁面
switch: function (e) {
    var aa = 'UNNZVUf5qkM=';//拼接到url的參數
    var urls = encodeURIComponent(aa);//先encodeURIComponent
    wx.navigateTo({
      url: '/pages/teaTestWork/teaTestWork?id=' + urls,
    })
    
  },

B頁面
onLoad: function (options) {
  
    console.log(decodeURIComponent(options.id));//結果為UNNZVUf5qkM=
    
  },
View Code

 


免責聲明!

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



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