当前位置:网站首页>微信小程序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
})
},
边栏推荐
- Leetcode 115. different subsequences
- Install, configure, and use the metroframework in the C WinForms application
- Decrypting numpy is a key difficulty in solving the gradient
- 【愚公系列】2022年7月 Go教学课程 016-运算符之逻辑运算符和其他运算符
- A scene application of 2D animation
- Introduction to bridging mode and sharing mode
- Observer mode
- Go basic notes_ 5_ Process statement
- JSON、
- Recycleview realizes horizontal sliding of overlapping items
猜你喜欢

Cointelegraph撰文:依托最大的DAO USDD成为最可靠的稳定币
![[daily question 1] 1184. Distance between bus stops](/img/36/2bbb8cc2a1fdd08070a5df7527e692.png)
[daily question 1] 1184. Distance between bus stops

Leetcode sword finger offer brush question notes

百度希壤首场元宇宙拍卖落槌,陈丹青六幅版画作品全部成交!

Will eating fermented steamed bread hurt your body
![[C language] program environment and preprocessing](/img/d6/d59a0d8d286ea9408043d8ad1e1348.png)
[C language] program environment and preprocessing

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

Labelme labels different objects, displays different colors and batch conversion

Not only log collection, but also the installation, configuration and use of project monitoring tool sentry

2022深圳杯
随机推荐
【obs】视频包发送的dts_usec 计算
Mathematics Olympiad vs Informatics Olympiad (July 19, 2022)
In container multicast
[sword finger offer] analog implementation ATOI
10 minutes to understand how JMeter plays with redis database
Do you know the same period last year in powerbi
Decrypting numpy is a key difficulty in solving the gradient
[C language] program environment and preprocessing
A little consideration of strategic mode
JSON、
The code of Keil and Si compiler is not aligned??
Yolov7 model reasoning and training its own data set
【每日一题】剑指 Offer II 115. 重建序列
Install, configure, and use the metroframework in the C WinForms application
在C# WinForms应用程序中安装,配置和使用MetroFramework
共模电感听过很多次,但是什么原理你们真的懂吗?
【SemiDrive源码分析】【驱动BringUp】38 - NorFlash & eMMC分区配置
CRC8 CRC16 table lookup method
Lpad() function and (row_number() over (order by) +...)
The ultimate difference between MVC and three-tier architecture