Home  >  Article  >  WeChat Applet  >  Analysis of jump parameters and objects in WeChat mini programs

Analysis of jump parameters and objects in WeChat mini programs

不言
不言Original
2018-06-27 15:10:092498browse

This article mainly introduces the detailed explanation and example code of WeChat applet's jump to pass parameters and objects, and friends in need can refer to the following

WeChat applet's jump to pass parameters and objects

WeChat Mini Program Jump Parameters

Generally, strings are passed to the next page. What if you want to pass objects?

My solution is to first convert the object into a json string and then go to the next page to convert the json string into an object. As follows:

let str=JSON.stringify(e.currentTarget.dataset.item);
wx.navigateTo({
url: '../toMybaby/babyDetail/babyDetail?jsonStr='+str,
success: function (res) {
// success
},
fail: function () {
// fail
},
complete: function () {
// complete
}
})

 onLoad:function(options){
  // 生命周期函数--监听页面加载
  let item=JSON.parse(options.jsonStr);
  this.setData({ward:item});
 },

The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Cache analysis in WeChat applet

About dynamic parameter transfer in WeChat applet

The above is the detailed content of Analysis of jump parameters and objects in WeChat mini programs. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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