当前位置:网站首页>微信小程序学习之五种页面跳转方法.
微信小程序学习之五种页面跳转方法.
2022-06-27 08:54:00 【.叹服】
第一种:<navigator></navigator>标签.
这是最常见的一种跳转方式,相当于html里的a标签.但需要注意的是 该方法不能跳转tabbar页面.
格式为:
<navigator url="........"></navigator>第二种:wx.navigateTo.
通过构造js函数,在函数中调用该接口可实现页面跳转的效果.但该接口同样不能跳转tabbar页面.跳转后左上角有返回小箭头,点击可返回原本页面.
格式为:
<view class="select_calculator" bindtap="next_calculator">next_calculator:function () {
wx.navigateTo({
url: '/pages/calculator/calculator',
})
},
第三种:wx.redirectTo.
关闭当前页面,跳转到应用内的某个页面(不能跳转tabbar页面)。类似于html中的 window.open('.....');
跳转后左上角出现返回小箭头,点击后可返回原本页面.
第四种:wx.switchTab.
跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面;该方法只能跳转tabbar页面.
例如:


js:
post_calculator:function () {
wx.switchTab({
url: '/pages/calculator/calculator',
})
},
})第五种:wx.reLaunch.
关闭所有页面,打开到应用内的某个页面。
跟 wx.redirectTo 一样左上角不会出现返回箭头,但两者却不完全相同;
边栏推荐
- 数字IC-1.9 吃透通信协议中状态机的代码编写套路
- 並發編程JUC的AQS底層源碼
- 2022.06.26(LC_6101_判断矩阵是否是一个 X 矩阵)
- Redis master-slave replication and sentinel mode
- Nosql 数据库 -Redis 安装
- March into machine learning -- Preface
- Object contains copy method?
- oracle用一条sql查出哪些数据不在某个表里
- A classic interview question covering 4 hot topics
- How much memory does the data type occupy? LongVsObject
猜你喜欢

One week's experience of using Obsidian (configuration, theme and plug-in)

Filter filter

C# 解决使用SQLite 的相对路径问题

我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!

Nosql 数据库 -Redis 安装

webrtc入门:12.Kurento下的RtpEndpoint和WebrtcEndpoint

Matlab tips (18) matrix analysis -- entropy weight method

E+H二次表维修PH变送器二次显示仪修理CPM253-MR0005

How Oracle converts strings to multiple lines

【生动理解】深度学习中常用的各项评价指标含义TP、FP、TN、FN、IoU、Accuracy
随机推荐
Collection framework generic LinkedList TreeSet
IMX8QXP DMA资源和使用(未完结)
CLassLoader
Redis configuration file details
This, constructor, static, and inter call must be understood!
2022.6.26-----leetcode. seven hundred and ten
E+H二次表维修PH变送器二次显示仪修理CPM253-MR0005
【mysql篇-基础篇】通用语法1
The largest rectangle in the bar graph of force buckle 84
orthofinder直系同源蛋白分析及结果处理
Conception de plusieurs classes
MySQL lock details
i=i++;
枚举?构造器?面试Demo
Summary of three basic interview questions
Code source AQS sous - jacent pour la programmation simultanée juc
Nosql 数据库 -Redis 安装
Several cases that do not initialize classes
直接修改/etc/crontab 文件内容,定时任务不生效
Process 0, process 1, process 2