当前位置:网站首页>微信小程序学习之五种页面跳转方法.
微信小程序学习之五种页面跳转方法.
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 一样左上角不会出现返回箭头,但两者却不完全相同;
边栏推荐
- 2022.06.26 (LC Luo 6101 Luo determines whether the matrix is an X matrix)
- ThreadLocal digs its knowledge points again
- About the problem that the El date picker Click to clear the parameter and make it null
- Creation process and memory layout of objects at JVM level
- IMX8QXP DMA资源和使用(未完结)
- Matlab tips (19) matrix analysis -- principal component analysis
- oracle怎样将字符串转为多行
- 静态代码块Vs构造代码块
- 2022.6.26-----leetcode. seven hundred and ten
- Redis transactions
猜你喜欢

The markdown plug-in of the browser cannot display the picture

Oracle uses an SQL to find out which data is not in a table

RMAN-08137 主库无法删除归档文件

MySQL锁详解

2022.06.26 (LC Luo 6101 Luo determines whether the matrix is an X matrix)

Redis master-slave replication and sentinel mode

Analysis of orthofinder lineal homologous proteins and result processing

2022.06.26(LC_6101_判断矩阵是否是一个 X 矩阵)

IO管脚配置和pinctrl驱动

数字IC-1.9 吃透通信协议中状态机的代码编写套路
随机推荐
vim 从嫌弃到依赖(19)——替换
即构「畅直播」,全链路升级的一站式直播服务
The largest rectangle in the bar graph of force buckle 84
第十一章 信号(一)- 概念
枚举?构造器?面试Demo
[diffusion model]
Five basic types of redis
Redis installation under Linux
【原创】TypeScript字符串utf-8编码解码
三道基础面试题总结
MySQL index details
VIM from dislike to dependence (19) -- substitution
Creation process and memory layout of objects at JVM level
Getting started with webrtc: 12 Rtendpoint and webrtcendpoint under kurento
[original] typescript string UTF-8 encoding and decoding
Design of a solar charge pump power supply circuit
How much do you know about the cause of amplifier distortion?
Chapter 11 signal (I) - concept
Static code block vs construction code block
Redis configuration file details