当前位置:网站首页>【WeChat Mini Program】Page Events
【WeChat Mini Program】Page Events
2022-07-30 08:38:00 【Small white white love of programming】
目录
小程序 - 视图与逻辑
页面导航 - 导航传参
1. 声明式导航传参
- 参数与路径之间使用 ? 分隔
- 参数键与参数值用 = 相连
- 不同参数用 & 分隔
<navigator url="/pages/info/info?name=zs&age=20">跳转到info页面</navigator>2. 编程式导航传参
<button bindtap="gotoInfo2">跳转到info页面</button> gotoInfo2() {
wx.navigateTo({
url: '/pages/info/info?name=ls&gender=男'
})
},3. 在 onLoad 中接收导航参数
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
//options是 导航 The passed parameter object
},页面事件 - 下拉刷新事件
1. 什么是下拉刷新
2. 启用下拉刷新
3. 配置下拉刷新窗口的样式
4. 监听页面的下拉刷新事件

<view>count值是:{
{count}}</view>
<button bindtap="addCount">+1</button> addCount() {
this.setData({
count: this.data.count + 1
})
},在触发页面的下拉刷新事件的时候,如果要把 count 的值重置为 0,示例代码如下:
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.setData({
count: 0
})
},5. 停止下拉刷新的效果
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
// console.log('触发了message页面的下拉刷新')
this.setData({
count: 0
})
//当数据重置成功后,调用此函数,关闭下拉刷新的效果
wx.stopPullDownRefresh()
},页面事件 - 上拉触底事件
1. 什么是上拉触底
2. 监听页面的上拉触底事件
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
console.log('The pull-up bottoming event is triggered')
},
3. 配置上拉触底距离
边栏推荐
- 【小程序专栏】总结uniapp开发小程序的开发规范
- 【Codeforces Round #805 (Div. 3)(A~C)】
- Get all interface paths and names in the controller
- golang: Gorm configures Mysql multiple data sources
- 你好,我的新名字叫 “铜锁 / Tongsuo”
- [GO Language Basics] 1. Why do I want to learn Golang and get started with GO language
- Fix datagrip connection sqlserver error: [08S01] The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption.
- K-Net:Towards Unified Image Segmentation,基于动态内核的通用分割网络,(NMS-free and Box-free),从语义/实例分割到全景分割。
- Hex conversion...
- redis多节点部署实施指引
猜你喜欢
随机推荐
MYSQL 主从恢复锁表后, 处理SQL 线程锁解决.
LeetCode:647. 回文子串
C13—使用innosetup工具制作软件安装向导2022-07-23
【day5】数组
golang grpc protoc 环境配置
General Lei's personal blog to see
便携小风扇PD取电芯片
Fix datagrip connection sqlserver error: [08S01] The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption.
Keil compile size and storage instructions
解决datagrip连接sqlserver报错:[08S01] 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。
AutoSAR EcuM系列02- Fixed EcuM的状态管理
Lenovo Notebook How to Change Windows 10 Boot Logo Icon
tabindex attribute of input tag & tabindex attribute of a tag
分布式锁开发
你好,我的新名字叫 “铜锁 / Tongsuo”
typescript4 - installs a toolkit for compiling ts
stack containing min function (js)
用代码收集每天热点内容信息,并发送到自己的邮箱
Delphi仿制Web的导航
Keil编译大小和存储说明









