当前位置:网站首页>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 //返回两层页面
});
边栏推荐
- MySQL 常用命令
- double类型精度丢失问题以及解决方法
- Les raccourcis clavier liés à l'onglet ne peuvent pas être utilisés après la mise à jour du vscode
- Live classroom system 03 supplement model class and entity
- MapReduce InputFormat之FileInputFormat
- 修改ssh命令行[[email protected]]#颜色
- Live classroom system 02 build project environment
- [转]基于POI的功能区划分()
- Linked list review!
- PostgreSQL has no NVL solution. PostgreSQL queries all tables
猜你喜欢

Matlab simulation of depth information extraction and target ranging based on binocular camera images

Fastapi application joins Nacos

颜值爆表 Redis官方可视化工具来啦,针不戳

BGP联邦实验

基于matlab的CBOC信号调制解调仿真,输出其相关性,功率谱以及频偏跟踪

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

Leetcode-227-basic calculator||

General of MySQL_ Log log

智头条:智装论坛将于8月4日举行,2022全屋智能销售将破100亿

深度学习单图三维人脸重建
随机推荐
Error | cannot read property '_ normalized‘ of undefined
深度学习单图三维人脸重建
IDEA 提高效率的5大免费插件
精品国创《少年歌行》数字藏品开售,邀你共铸少年武侠江湖梦
粒子边界碰撞的处理
double类型精度丢失问题以及解决方法
【启发式分治】启发式合并的逆思想
Leetcode: 17. letter combination of phone number
Simulation of synchronization performance of BOC modulation and demodulation based on MATLAB, output tracking curve and identification curve under different lead lag code distance
VSCode 更新後與tab相關快捷鍵無法使用
go : gin Urlencoded 格式
如何实现多个传感器与西门子PLC之间485无线通讯?
[untitled]
动态规划-力扣
修改ssh命令行[[email protected]]#颜色
C# 计算某个字符在字符串中出现的次数
Linked list review!
易基因|靶基因DNA甲基化测序(Target-BS)
BGP联邦实验
Les raccourcis clavier liés à l'onglet ne peuvent pas être utilisés après la mise à jour du vscode