当前位置:网站首页>小程序:区域滚动、下拉刷新、上拉加载更多
小程序:区域滚动、下拉刷新、上拉加载更多
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
边栏推荐
- Routing knowledge
- Is the array name a pointer
- The function parameters of the new features of ES6 are assigned initial values and rest parameters
- Configmap配置与Secret加密
- Communication between parent-child components and parent-child components provide and inject
- JS realizes the function of one click Copy
- SQL server how to judge when the parameter received by the stored procedure is of type int?
- Pointer of pointer???...
- 当我从数据库获取到了winfrom特定的控件ID之后我需要通过这个ID找到对应的控件,并对控件的TEXT文本进行赋值这该怎么做
- [原理] 横向渗透的几种方式
猜你喜欢

Meeting notice of OA project (Query & whether to attend the meeting & feedback details)

面试必备!TCP协议经典十五连问!

BGP的基础配置---建立对等体、路由宣告

Value transmission and address transmission of C language, pointer of pointer

Is the array name a pointer

Function pointer and callback function

mmdetection初步使用

Press the missing number of interview question 17.04 | | 260. the number that appears only once (including bit operation knowledge points)

华为天才少年稚晖君做了一把模块化机械键盘,引起极客圈地震,网友:这才是真正的客制化...

HCIP BGP
随机推荐
数据源是SQL server ,我要配置日期字段 updateDate 最后两天日期的增量数据,做增
The output comparison function of Tim is introduced in detail through PWM breathing lamp and PWM controlled DC motor
Zhihuijun, a genius of Huawei, made a modular mechanical keyboard, which caused an earthquake in the geek circle. Netizens: This is the real customization
"Weilai Cup" 2022 Niuke summer multi school training camp 1 J serval and essay (heuristic merger)
Summary on the thought of double pointer
Is the array name a pointer
CUB_ Visualization of key points in 200 bird dataset
HCIP BGP
C语言实现三子棋游戏(详解)
“蔚来杯“2022牛客暑期多校训练营1 J Serval and Essay(启发式合并)
How to write the filter conditions of data integration and what syntax to use? SQL syntax processing bizdate can not be
%s. %c, character constant, string constant, const char*, pointer array, string array summary
Typescript from getting started to mastering (XX) function generics
MySQL Part 3
Is there any way for Youxuan database to check the log volume that the primary cluster transmits to the standby cluster every day?
Codeforces round 810 (Div. 2) d. rain (segment tree difference)
Press the missing number of interview question 17.04 | | 260. the number that appears only once (including bit operation knowledge points)
路西法98-生活记录ing
【BGP】小型实验
关于ALV格式控制部分的写法