当前位置:网站首页>Wechat applet page jump to pass parameters
Wechat applet page jump to pass parameters
2022-08-05 06:13:00 【CrazyQiQi】
First of all, there are APIs that can pass parameters when jumping to the applet page
- wx.navigateTo()
Keep the current page and jump to a page in the app.But can't jump to the tabbar page - wx.reLaunchTo()
Close all pages, open to a page in the app - wx.redirectTo()
Close the current page and jump to a page in the application.But it is not allowed to jump to the tabbar page.
When jumping with wx.navigateTo()
, it is necessary to convert the data of the json object into the form of a string
We need to perform a process similar to packing and unpacking the json array through these two functions.
JSON.stringify();//Convert json to string valueJSON.parse();//Convert the string toObject Receive
This is the json array we pass across pages
var json = [{"gender": "gender","weight": "weight"}]
The next step is to pass the path with parameters, convert the parameters into string format, and pass them to the target page
wx.navigateTo({//url fill in the page you want to jump tourl: './../index/index?json=' + JSON.stringify(json) //Convert json array to string
After passing at the same time, we need to take out the passed parameters on the target page
/** * Lifecycle function -- monitor page loading */onLoad: function (options) {var list = JSON.parse(options.json) //The string passed from the first page is converted into a json arrayconsole.log(list)
边栏推荐
- Getting Started Doc 08 Conditional Plugins
- I217-V network disconnection problem in large traffic under openwrt soft routing
- 【Day8】 RAID磁盘阵列
- 时间复杂度和空间复杂度
- VLAN详解及实验
- [Day1] (Super detailed steps) Build a soft RAID disk array
- 【机器学习】1单变量线性回归
- js动态获取屏幕宽高度
- spark operator-textFile operator
- IJCAI 2022|Boundary-Guided Camouflage Object Detection Model BGNet
猜你喜欢
随机推荐
spark算子-textFile算子
Getting Started 11 Automatically add version numbers
Transport layer protocol (TCP 3-way handshake)
ROS视频教程
正则表达式小实例--验证邮箱地址
static routing
PVE 直通硬盘到TrueNAS
Getting Started 05 Using cb() to indicate that the current task is complete
Remembering my first CCF-A conference paper | After six rejections, my paper is finally accepted, yay!
spark算子-map vs mapPartitions算子
【Day8】磁盘及磁盘的分区有关知识
[Day1] (Super detailed steps) Build a soft RAID disk array
Hard Disk Partitioning and Permanent Mounting
[Day8] (Super detailed steps) Use LVM to expand capacity
[Day1] VMware software installation
spark源码-任务提交流程之-3-ApplicationMaster
markdown编辑器模板
Three modes of vim
OpenCV3.0 兼容VS2010与VS2013的问题
The Servlet to jump to the JSP page, forwarding and redirection