当前位置:网站首页>一文读懂小程序的生命周期和路由跳转
一文读懂小程序的生命周期和路由跳转
2022-07-25 10:06:00 【华为云】
目录
2.通过api跳转wx.navigateTo() , wx.navigateBack(), wx.redirectTo() , wx.switchTab(), wx.reLanch()
前言
微信小程序是一种不需要下载安装即可使用的应用,它实现了应用“触手可及”的梦想,用户扫一扫或者搜一下即可打开应用。也体现了“用完即走”的理念,用户不用关心是否安装太多应用的问题。应用将无处不在,随时可用,但又无需安装卸载。对于开发者而言,微信小程序开发门槛相对较低,难度不及APP,能够满足简单的基础应用,适合生活服务类线下商铺以及非刚需低频应用的转换。微信小程序能够实现消息通知、线下扫码、公众号关联等七大功能。其中,通过公众号关联,用户可以实现公众号与微信小程序之间相互跳转。
一、微信小程序与vue对比
1、在结构和样式方面
2、在调用微信生态系统功能时
获取地理位置信息 wx.getLocation、
文件保存 等等
二、小程序生命周期
- onReady 生命周期函数--监听页面初次渲染完成
- onShow 生命周期函数--监听页面显示
- onHide 生命周期函数--监听页面隐藏
- onUnload 生命周期函数--监听页面卸载
- onPullDownRefresh 页面相关事件处理函数--监听用户下拉动作
- onReachBottom 页面上拉触底事件的处理函数
- onShareAppMessage 用户点击右上角转发
- onPageScroll 页面滚动触发事件的处理函数
- onTabItemTap 当前是 tab 页时,点击 tab 时触发
三、小程序路由跳转
1. 通过组件navigator跳转
代码如下(示例):
2.通过api跳转
wx.navigateTo() , wx.navigateBack(), wx.redirectTo() , wx.switchTab(), wx.reLanch()
代码如下(示例):
总结
以上就是今天要讲的内容,本文仅仅简单介绍了微信小程序的生命周期和路由跳转方法,以及和vue项目的对比,希望对大家有所帮助
边栏推荐
- HCIP (01)
- 4.FTP服务配置与原理
- 淦,为什么 '𠮷𠮷𠮷' .length !== 3 ??
- AI技术栈太庞大!吴恩达给出职业生涯规划:终生学习
- Upgrade glibc 2.29 checking LD_ LIBRARY_ Path variable... Contains current directory error solution
- Visual thematic map of American airport go style: ArcGIS Pro version
- Flask框架——flask-caching缓存
- 接口流量突增,如何做好性能调优?
- 3.跟你思想一样DNS域名解析服务!!!
- 2. Conditional statements of shell script
猜你喜欢
![[strategic mode] like Zhugeliang's brocade bag](/img/c8/4baeabbc3674b956f6d376ab71e15a.png)
[strategic mode] like Zhugeliang's brocade bag

Configuration of static routes (take Huawei ENSP as an example)

Modify MySQL group error expression 1 of select list is not in group

Trojang attack on neural networks paper reading notes

2.shell脚本之条件语句

1. Shell programming specifications and variables

微信小程序WxPrase中包含文件无法点击解决

Kraken中事件通道原理分析

2021 jd.com written examination summary

Use three.js to realize the cool cyberpunk style 3D digital earth large screen
随机推荐
js 哈希表 02
js 哈希表 01
平凡人的一生的意义是什么?
树形动态规划
Differences between redis and mongodb
js 双向链表 02
String longest common prefix
Attention is all you need paper intensive reading notes transformer
UE4 loadingscreen dynamic loading startup animation
3.信你能理解的!shell脚本之循环语句与函数,数组,冒泡排序
HCIA实验(10)NAT
HCIP实验(03)
Keras deep learning practice (16) -- detailed explanation of self encoder
UE4 framework introduction
JS bidirectional linked list 02
Disabled and readonly and focus issues
2. Introduce the deployment of lamp platform +discuz Forum
JS collection
UE4 window control (maximize minimize)
异步Servlet在转转图片服务的实践




