当前位置:网站首页>小程序:区域滚动、下拉刷新、上拉加载更多
小程序:区域滚动、下拉刷新、上拉加载更多
2022-07-29 04:07:00 【[email protected]】
一、简介
开发环境:小程序、uniapp
实现功能:列表页面实现,区域滚动、下拉刷新、上拉加载更多,效果如图:
正常:

下拉刷新:

上拉加载:

二、实现
2.1、代码
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="lower" refresher-enabled="true" @refresherrefresh="refresher" :refresher-triggered="triggered" @refresherrestore="onRestore" @refresherabort="onAbort" v-if = "patList.length > 0">
<view class="itemList" @click="toDetail(item.caseId,item.identifier)" v-for="(item,index) in patList" :key="index">
<view class="title">
<span class="name">翁美玲</span>
<span class="time">2022-07-15</span>
</view>
</view>
<view class="loading">
<view class="tips" v-if="loadings === '0'">这是我的底线了~</view>
<view class="tips" v-else-if="loadings === '1'">上拉加载更多...</view>
<view class="imgs" v-else-if="loadings === '2'">
<image src="load.png" mode=""></image>
<text>加载中...</text>
</view>
</view>
</scroll-view>
-------------------------------------------------
lower(){
console.log('滚动到底部')
this.page ++
this.getList()
},
refresher(){
console.log('下拉刷新',this._freshing,this.triggered)
if (this._freshing) return;
this._freshing = true;
this.triggered = true
this.page = 1
this.getList()
//getList方法执行结束后恢复下边两个状态
//this.triggered = false;
//this._freshing = false;
},2.2、 解析:
2.2.1、<scroll-view></scroll-view>,定义需要滚动的区域
2.2.2、:scroll-y,允许纵向滚动
2.2.3、@scrolltolower="lower",事件:滚动到底部/右边时触发,可以调用加载下一页数据了
2.2.4、:refresher-enabled="true",属性:开启自定义下拉刷新
2.2.5、@refresherrefresh="refresher",事件:自定义下拉刷新被触发,可以重新调用接口了
2.2.6、:refresher-triggered="triggered",属性:设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
2.2.7、@refresherrestore="onRestore",事件:自定义下拉刷新被复位
2.2.8、@refresherabort="onAbort",事件:自定义下拉刷新被中止
三、虽然很简单,但是我觉得每个知识点都应该被记录。欢迎交流指正,关注我,一起学习。
四、参考文档:
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://blog.csdn.net/snowball_li/article/details/125962775
边栏推荐
- HCIP BGP
- Typescript from entry to mastery (XXI) generic types in classes
- rman不标记过期备份
- A little understanding of pointer, secondary pointer, wild pointer, pointer as function return value
- Mmdetection preliminary use
- 数据库SQL语句实现数据分解的函数查询
- pat A1041 Be Unique
- [kvm] create virtual machine from kickstart file
- The difference between dynamic, VaR and object in fluent
- 这个报错是什么鬼啊,不影响执行结果,但是在执行sql时一直报错。。。连接maxComputer是使用
猜你喜欢

Blood cases caused by < meta charset=UTF-8> -- Analysis of common character codes

MPU6050

Lua language (stm32+2g/4g module) and C language (stm32+esp8266) methods of extracting relevant data from strings - collation

Typescript from getting started to mastering (XVI) configuration file - first knowledge of compileroptions configuration item

LDP -- label distribution protocol

MPU6050

力扣面试题17.04 消失的数字||260.只出现一次的数字(内含位运算知识点)

2021 sist summer camp experience + record post of School of information, Shanghai University of science and technology
![[deep learning CPU (part outside) - virtual memory]](/img/f7/4c72d583456f6f68c52424602ff5d9.png)
[deep learning CPU (part outside) - virtual memory]

内连接和左连接简单案例
随机推荐
当我从数据库获取到了winfrom特定的控件ID之后我需要通过这个ID找到对应的控件,并对控件的TEXT文本进行赋值这该怎么做
安装postgis时报找不到“POSTGIS_VERSION”这个函数
面试必备!TCP协议经典十五连问!
JS cookie usage
安装ros的laser_scan_matche库所遇到的问题(一)
MySQL Part 4 (end)
Rhel8 patch package production
CUB_ Visualization of key points in 200 bird dataset
MySQL第三篇
Fu Yingna: Yuan universe is the new generation of Internet!
Problems encountered in vscode connection SSH
The digitalization of the consumer industry is upgraded to "rigid demand", and weiit's new retail SaaS empowers enterprises!
rman不标记过期备份
数据挖掘——关联分析例题代码实现(下)
Const char* and char*, string constants
大佬们flink的JDBC SQL Connector现在不支持所有的数据库吗,例如vertica?
Solution: module 'xlrd' has no attribute 'open_ Error reporting of workbook '
优炫数据库有办法查到主集群每天传给备集群的日志量吗?
一文学透MySQL表的创建和约束
Routing knowledge