当前位置:网站首页>小程序:区域滚动、下拉刷新、上拉加载更多
小程序:区域滚动、下拉刷新、上拉加载更多
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
边栏推荐
- 第一个ALV程序2
- 关于双指针的思想总结
- Typescript from entry to mastery (XXI) generic types in classes
- JS realizes the function of one click Copy
- Is the array name a pointer
- Nacos registry
- How to write the filter conditions of data integration and what syntax to use? SQL syntax processing bizdate can not be
- AssertionError(“Torch not compiled with CUDA enabled“)
- Summary on the thought of double pointer
- Codeforces Round #810 (Div. 2) D. Rain (线段树差分)
猜你喜欢
随机推荐
华为天才少年稚晖君做了一把模块化机械键盘,引起极客圈地震,网友:这才是真正的客制化...
Typescript from entry to mastery (XVIII) joint type and type protection
Communication between parent-child components and parent-child components provide and inject
Meeting notice of OA project (Query & whether to attend the meeting & feedback details)
Typescript from getting started to mastering (19) enumeration types
SQL窗口函数
AssertionError(“Torch not compiled with CUDA enabled“)
MySQL Part 3
Codeforces round 810 (Div. 2) d. rain (segment tree difference)
HCIP BGP
Install the laser of ROS_ scan_ Problems encountered in match library (I)
C language to achieve three chess game (detailed explanation)
The structure pointer must be initialized, and the pointer must also be initialized
[untitled]
Is the browser multi process or single process?
2021 sist summer camp experience + record post of School of information, Shanghai University of science and technology
数据挖掘——关联分析基础介绍(上)
请问为什么我进行mysql数据update时,kafka中采集到的是先删除原纪录(op d)再新增新
Zhihuijun, a genius of Huawei, made a modular mechanical keyboard, which caused an earthquake in the geek circle. Netizens: This is the real customization
Safari's compatibility with Z-index





![[Openstack] keystone,nova](/img/de/70b654a29a813c8fe828c4018bd4e7.png)


