Analysis of jump parameters and objects in WeChat mini programs

不言
Release: 2018-06-27 15:10:09
Original
2498 people have browsed it

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
}
})
Copy after login

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template