当前位置:网站首页>uniapp路由跳转的六种方式
uniapp路由跳转的六种方式
2022-07-23 10:41:00 【天使的同类】
uniapp官方文档详解:

一、uni.navigateTo保留当前页面,跳转到应用内的某个页面,使用uni.navigateBack可以返回到原页面。
uni.navigateTo({
url:'./index/index'
});
注意:
- 页面跳转路径有层级限制,不能无限制跳转新页面
- 跳转到 tabBar 页面只能使用 switchTab 跳转
二、uni.redirectTo关闭当前页面,跳转到应用内的某个页面。
uni.redirectTo({
url: './index/index'
});
三、uni.reLaunch关闭所有页面,打开到应用内的某个页面。
uni.reLaunch({
url: './index/index'
});
四、uni.switchTab跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面。
uni.switchTab({
url: '/pages/index/index'
});
注意:
- 需要跳转的 tabBar 页面的路径(在pages.json文件中配置的tabBar页面),路径后不能带参数,可以用uni.reLaunch代替
五、uni.navigateBack关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages() 获取当前的页面栈,决定需要返回几层。
uni.navigateBack({
delta: 2 //返回两层页面
});
边栏推荐
猜你喜欢

Les raccourcis clavier liés à l'onglet ne peuvent pas être utilisés après la mise à jour du vscode

安全合理用电 收获清凉一“夏”

xlswriter - excel导出

麒麟V10源码编译qtCreator4.0.3记录

Head pose estimation principle and visualization_ Loveliuzz's blog - Programmer's Homestead_ Head posture estimation

leetcode: 17. 电话号码的字母组合

Start process of activity

How to realize 485 wireless communication between multiple sensors and Siemens PLC?

他山之石 | 阿里多模态知识图谱探索与实践

Postgresql快照优化Globalvis新体系分析(性能大幅增强)
随机推荐
[untitled] test [untitled] test
Kettle實現共享數據庫連接及插入更新組件實例
基于simulink的双闭环矢量控制的电压型PWM整流器仿真
Shell脚本案例---3
基于matlab的BOC调制信号捕获仿真
[untitled]
[CTFHub]JWT 的头部和有效载荷这两部分的数据是以明文形式传输的,如果其中包含了敏感信息的话,就会发生敏感信息泄露。试着找出FLAG。格式为 flag{}
基于matlab的BOC调制解调的同步性能仿真,输出跟踪曲线以及不同超前滞后码距下的鉴别曲线
ERP管理系统在装备制造企业管理中的应用
day18
智头条:智装论坛将于8月4日举行,2022全屋智能销售将破100亿
读写锁ReadWriteLock还是不够快?再试试S…
[转]基于POI的功能区划分()
leetcode: 17. 电话号码的字母组合
The problem of double type precision loss and its solution
The current situation and history of it migrant workers
颜值爆表 Redis官方可视化工具来啦,针不戳
CBOC signal modulation and demodulation simulation based on MATLAB, output its correlation, power spectrum and frequency offset tracking
Live classroom system 03 model class and entity
Kettle implements shared database connection and insert update component instances