当前位置:网站首页>一文读懂小程序的生命周期和路由跳转
一文读懂小程序的生命周期和路由跳转
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项目的对比,希望对大家有所帮助
边栏推荐
- Pytoch separates tensor by the value of one dimension of tensor (simple)
- HCIP实验(01)
- Several common network diagnostic commands
- Disabled and readonly and focus issues
- Flask框架——flask-caching缓存
- Mysql5.7 master-slave database deployment (offline deployment)
- DHCP configuration (take Huawei ENSP as an example)
- AI technology stack is too huge! Wu Enda gives career planning: lifelong learning
- 使用Numpy进行高程统计及可视化
- 微波技术基础实验一 滤波器的设计
猜你喜欢

HCIP实验(02)

Vscode latex workshop set xelatex compilation

The most comprehensive UE4 file operation in history, including opening, reading, writing, adding, deleting, modifying and checking

Microwave technology homework course design - Discrete capacitance and inductance + microstrip single stub + microstrip double stub
C class library generation, use class library objects to data bind DataGridView

4. FTP service configuration and principle

2021 Niuke written examination summary 02

Using px2rem does not take effect

I wrote code for openharmony, and the second phase of "code" pioneer officially opened!

Flask框架——消息闪现
随机推荐
6. PXE combines kickstart principle and configuration to realize unattended automatic installation
Leetcode 560 prefix and + hash table
Deploy master-slave database
MySQL offline deployment
2021 jd.com written examination summary
推荐系统-协同过滤在Spark中的实现
What is the meaning of ordinary people's life?
Qt | 鼠标事件和滚轮事件 QMouseEvent、QWheelEvent
Basic experiment of microwave technology - Filter Design
2. Introduce the deployment of lamp platform +discuz Forum
The practice of asynchronous servlet in image service
使用Numpy进行高程统计及可视化
Gan, why '𠮷 𠮷'.Length== 3 ??
BGP联邦实验
Configuration of static routes (take Huawei ENSP as an example)
Trojang attack on neural networks paper reading notes
代码的表示学习:CodeBERT及其他相关模型介绍
淦,为什么 '𠮷𠮷𠮷' .length !== 3 ??
C3d model pytorch source code sentence by sentence analysis (III)
Electromagnetic field and electromagnetic wave experiment I familiar with the application of MATLAB software in the field of electromagnetic field




