当前位置:网站首页>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'))
边栏推荐
猜你喜欢
STL教程10-容器共性和使用场景
shardingSphere分库分表<3>
ftp登录时,报错“530 Login incorrect.Login failed”
(构造笔记)ADT与OOP
The excel table is transferred to word, and the table does not exceed the edge paper range
牛牛的组队竞赛
During FTP login, the error "530 login incorrect.login failed" is reported
vulnhub之GeminiInc v2
Ripper of vulnhub
[learning notes] DP status and transfer
随机推荐
Vulnhub narak
(database authorization - redis) summary of unauthorized access vulnerabilities in redis
Visual Studio 2022下载及配置OpenCV4.5.5
OpenStack中的测试分类
pragma-pack语法与使用
PHP export word method (phpword)
previous permutation lintcode51
Shardingsphere sub database and sub table < 3 >
Sheet1$. Output [excel source output] Error in column [xxx]. The returned column status is: "the text is truncated, or one or more characters have no matches in the target code page.".
2022年湖南工学院ACM集训第二次周测题解
Yintai department store ignites the city's "night economy"
Solve msvcp120d DLL and msvcr120d DLL missing
CGroup introduction
Master and backup role election strategy in kept
Why can't my MySQL container start
【mysql专项】读锁和写锁
STL教程8-map
Wrong arrangement (lottery, email)
Vulnhub's Tomato (tomato)
R language uses grid of gridextra package The array function combines multiple visual images of the lattice package horizontally, and the ncol parameter defines the number of columns of the combined g