当前位置:网站首页>Wechat applet development - page Jump transfer parameters
Wechat applet development - page Jump transfer parameters
2022-07-03 12:01:00 【A rookie professional dedicated to writing code】
Wechat applet development - Page jump pass parameters
There are four ways of page Jump , Respectively wx.navigateTo、wx.redirectTo、wx.reLaunch、wx.switchTab, The first three can be passed url The path carries parameters to realize parameter transfer , Such as
wx.navigateTo({
url: '/pages/detail/detail?info='+info
})
And by wx.switchTab Jump to tabBar When the page is , Parameters cannot be passed in the above way , There are two solutions :
The first one is , adopt app.js Global variables pass parameters
//app.js in
globalData: {
info:null,
userInfo: null
}
// On the page where parameters are passed js In file
const app=getApp()
app.globalData.info="info"
// On the page receiving parameters js In file
const app=getApp()
console.log(' adopt app.js Global variables pass parameters ',app.globalData.info)
The second kind , Pass parameters through cache
// In the page file that passes parameters js in
wx.setStorageSync('info', info)
// In the page file that receives parameters js in
console.log(' Pass parameters through cache ',wx.getStorageSync('info'))
边栏推荐
- During FTP login, the error "530 login incorrect.login failed" is reported
- OpenStack中的测试分类
- Download address and installation tutorial of vs2015
- Wrong arrangement (lottery, email)
- Qt OpenGL 纹理贴图
- Shardingsphere sub database and sub table < 3 >
- Hongmeng fourth training
- vulnhub之momentum
- Groovy测试类 和 Junit测试
- Qt+vtk+occt reading iges/step model
猜你喜欢
随机推荐
《剑指offer 03》数组中重复的数字
Ripper of vulnhub
Redis notes 01: Introduction
shardingSphere分库分表<3>
Basic knowledge of OpenGL (sort it out according to your own understanding)
Vulnhub's cereal
(数据库提权——Redis)Redis未授权访问漏洞总结
Solve msvcp120d DLL and msvcr120d DLL missing
OpenStack中的测试分类
(数据库提权——Redis)Redis未授权访问漏洞总结
剑指offer专项32-96题做题笔记
DEJA_VU3D - Cesium功能集 之 054-模拟火箭发射全过程
The uniapp scroll view solves the problems of high adaptability and bullet frame rolling penetration.
网络通讯之Socket-Tcp(一)
previous permutation lintcode51
laravel 时区问题timezone
pragma-pack语法与使用
OpenGL 着色器使用
STL tutorial 10 container commonalities and usage scenarios
Socket TCP for network communication (I)









