当前位置:网站首页>一文读懂小程序的生命周期和路由跳转
一文读懂小程序的生命周期和路由跳转
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项目的对比,希望对大家有所帮助
边栏推荐
- 5.NFS共享服务和ssh远程控制服务
- 8.shell文件处理三剑客之sed
- Qt | 鼠标事件和滚轮事件 QMouseEvent、QWheelEvent
- disabled和readonly 以及焦点问题
- Pytorch code template (CNN)
- 异步Servlet在转转图片服务的实践
- 4. FTP service configuration and principle
- The idea has been perfectly verified again! The interest rate hike is approaching, and the trend is clear. Take advantage of this wave of market!
- Deploy master-slave database
- 7.shell实用的小工具cut等
猜你喜欢

HCIP实验(03)

Set up lnmp+discuz Forum

微波技术基础实验一 滤波器的设计

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

Basic experiment of microwave technology - Filter Design

6. Regular expression of shell

我为OpenHarmony 写代码,战“码”先锋第二期正式开启!

2021 written examination summary of niuke.com 01

Pytorch tensor list is converted to tensor list of tensor to tensor using torch.stack()

js 集合
随机推荐
VLAN configuration and application (take Huawei ENSP as an example)
Electromagnetic field and electromagnetic wave experiment I familiar with the application of MATLAB software in the field of electromagnetic field
推荐系统-协同过滤在Spark中的实现
微波技术基础实验一 滤波器的设计
基于cornerstone.js的dicom医学影像查看浏览功能
HCIP实验(04)
JS collection
[strategic mode] like Zhugeliang's brocade bag
Keras deep learning practice (16) -- detailed explanation of self encoder
信号完整性(SI)电源完整性(PI)学习笔记(三十四)100条估计信号完整性效应的经验法则
ESP32C3基于Arduino框架下的 ESP32 RainMaker开发示例教程
Pytorch code template (CNN)
Flask框架——消息闪现
Using px2rem does not take effect
C3d model pytorch source code sentence by sentence analysis (III)
8.shell文件处理三剑客之sed
Flask框架——Flask-WTF表单:数据验证、CSRF保护
disabled和readonly 以及焦点问题
After switching the shell command line terminal (bash/zsh), CONDA cannot be used: command not found
Modify MySQL group error expression 1 of select list is not in group




