当前位置:网站首页>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)
边栏推荐
猜你喜欢
运维的高光时刻,从智能化开始
【Day5】软硬链接 文件存储,删除,目录管理命令
Getting Started 05 Using cb() to indicate that the current task is complete
【Machine Learning】1 Univariate Linear Regression
入门文档12 webserve + 热更新
Autoware中安装Yolo3目标检测模块遇到的问题
Account and Permission Management
[Day6] File system permission management, file special permissions, hidden attributes
交换机原理
static routing
随机推荐
Getting Started 11 Automatically add version numbers
spark源码-任务提交流程之-5-CoarseGrainedExecutorBackend
The Servlet to jump to the JSP page, forwarding and redirection
VLAN details and experiments
云计算——osi七层与TCP\IP协议
IP address and subnet division
One-arm routing and 30% switch
【Day8】RAID Disk Array
spark源码-任务提交流程之-4-container中启动executor
js动态获取屏幕宽高度
ACL 和NAT
账号与权限管理
入门文档03 区分开发与生产环境(生产环境才执行‘热更新’)
CIPU,对云计算产业有什么影响
Wireshark抓包及常用过滤方法
深度 Zabbix 使用指南——来自惨绿少年
Spark source code-task submission process-6.2-sparkContext initialization-TaskScheduler task scheduler
入门文档09 独立的watch
Hard Disk Partitioning and Permanent Mounting
Image compression failure problem