当前位置:网站首页>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 stringAfter 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)边栏推荐
猜你喜欢
随机推荐
I/O performance and reliability
dsf5.0 弹框点确定没有返回值的问题
Dsf5.0 bounced points determine not return a value
Getting Started Document 07 Staged Output
时间复杂度和空间复杂度
spark源码-任务提交流程之-4-container中启动executor
The spark operator - repartition operator
Remembering my first CCF-A conference paper | After six rejections, my paper is finally accepted, yay!
VRRP原理及命令
微信小程序页面跳转传参
spark operator-wholeTextFiles operator
IP packet format (ICMP protocol and ARP protocol)
Configuration of TensorFlow ObjecDetectionAPI under Anaconda3 of win10 system
spark源码-任务提交流程之-2-YarnClusterApplication
I217-V在openwrt软路由下大流量断网问题
【Day5】软硬链接 文件存储,删除,目录管理命令
技术分享杂七杂八技术
【Day8】RAID Disk Array
入门文档05 使用cb()指示当前任务已完成
IJCAI 2022|Boundary-Guided Camouflage Object Detection Model BGNet








