当前位置:网站首页>微信小程序switchTab传参以及接收参数
微信小程序switchTab传参以及接收参数
2022-07-25 06:58:00 【追风少年?】
wx.switchTab({
url: '/yb_mingpian/pages/newIndex/newIndex?is_first_login=1',
});
这样的传参方式是不行的

解决方法:
我们可以在switch跳转之前设置一个全局变量,到下一个页面的时候,直接去获取全局变量
index.js 保存参数先
wx.request({
url: "http://127.0.0.1:5000/wx_login",
method: 'POST',
data: e.detail.value,
success: function (res) {
// console.log(res.data);
if (res.data.status == 1) {
wx.showToast({
title: "登录成功",
icon: "success",
duration: 3000
})
getApp().globalData.md_username = res.data.wx_username, //登录用户名
getApp().globalData.md_store = res.data.store, //门店
getApp().globalData.md_level = res.data.level, //等级
getApp().globalData.md_greetings = res.data.greetings, //问候语
wx.switchTab({
url: '../contact/contact',
})
} else {
wx.showToast({
title: "账号或密码不对",
icon: "none",
duration: 3000
})
}
}
})contact.js 获取参数
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.setNavigationBarTitle({
title: getApp().globalData.md_greetings
})
},
边栏推荐
- Addition, deletion, modification and query of DOM elements
- HTX00001_ Keil51 bug encountered in serial port parsing
- Over adapter mode
- Developers must read: 2022 mobile application operation growth insight white paper
- Expandablelistview nested GridView display incomplete problem
- C control open source library: download of metroframework
- [daily question 1] 1184. Distance between bus stops
- Install, configure, and use the metroframework in the C WinForms application
- JZ7 rebuild binary tree
- 探讨影响自动化测试成败的重要因素
猜你喜欢
![[Yugong series] July 2022 go teaching course 016 logical operators and other operators of operators](/img/36/9ad3f76078153f6af6c5b59d99564a.png)
[Yugong series] July 2022 go teaching course 016 logical operators and other operators of operators

Yolov7 model reasoning and training its own data set

10分钟看懂Jmeter 是如何玩转 redis 数据库的

【C】程序环境和预处理

Insight into mobile application operation growth in 2022 white paper: the way to "break the situation" in the era of diminishing traffic dividends
![[daily question 1] 1184. Distance between bus stops](/img/36/2bbb8cc2a1fdd08070a5df7527e692.png)
[daily question 1] 1184. Distance between bus stops

代码中的软件工程:正则表达式十步通关

LeetCode46全排列(回溯入门)

Labelme labels different objects, displays different colors and batch conversion

C#控件开源库:MetroFramework的下载
随机推荐
Baidu xirang's first yuan universe auction ended, and Chen Danqing's six printmaking works were all sold!
流量对于元宇宙来讲并不是最重要的,能否真正给传统的生活方式和生产方式带来改变,才是最重要的
DOM event type
HTX00001_ Keil51 bug encountered in serial port parsing
C language -c51 compilation warning "* * * warning l1: unresolved external symbol" and extern
A little consideration of strategic mode
C#控件开源库:MetroFramework的下载
[C language] program environment and preprocessing
Kyligence Li Dong: from the data lake to the index middle stage, improve the ROI of data analysis
JS array = number assignment changes by one, causing the problem of changing the original array
150. Evaluation of inverse Polish expression
js数据类型的判断——案例6精致而优雅的判断数据类型
EFCore高级Saas系统下单DbContext如何支持不同数据库的迁移
Dynamic memory management
Simple factory factory method Abstract Factory
Example demonstration of math.random() random function
C # --metroframework framework calls the metromodernui library and uses it in the toolbar
[OBS] DTS sent by video packet_ USEC calculation
The income of bank financial management is getting lower and lower. Now which financial products have high income?
Software engineering in Code: regular expression ten step clearance