当前位置:网站首页>scroll-view實現下拉刷新(避免onload進入頁面初始refresher-triggered為true觸發下拉問題)
scroll-view實現下拉刷新(避免onload進入頁面初始refresher-triggered為true觸發下拉問題)
2022-07-24 00:53:00 【路光.】
避免初始進入頁面由於要將refresher-triggered為true才可正常使用下拉加載問題
<scroll-view scroll-y="true" :style="{height:scrollH+'px'}"
:refresher-triggered="triggered" @scrolltolower="scrolltolower"
:refresher-threshold="100"
@refresherrefresh="onRefresh" @refresherrestore="onRestore"
@refresherabort="onAbort" refresher-background="linear-gradient( to right, #A0AAFF,#5E6EFF)"
@refresherpulling="refreshPullingTap" :refresher-enabled="isRefresher">
<view></view>
</scroll-view>data(){
return{
scrollH:0,
triggered:false,
_freshing:false,
isRefresher:true
}
},
methods:{
scrolltolower(e){
uni.$u.throttle(this.commonPage(), 1000)
},
onRefresh(){
if (this._freshing) return;
this._freshing = true;
this.findRecruitNewsList(0);
let tName=setTimeout(()=>{
clearTimeout(tName)
this.triggered = false;
this._freshing = false;
},1000)
},
onRestore(){
this.triggered = 'restore';
},
onAbort(){
},
refreshPullingTap(){
},
}關鍵代碼:
onLoad(){
//設置一個控制開啟自定義下拉刷新開關
this.isRefresher=false;
let t=setTimeout(() => {
clearTimeout(t);
this.triggered = true;
}, 1000)
let ts=setTimeout(()=>{
clearTimeout(ts);
this.isRefresher=true;
},3000)
},
边栏推荐
- 网络系统实验:ping不通的问题解决
- T-seda code
- 入职3个月的测试员面临转正,领导:1年工作经验包装成5年,试用期淘汰
- Focus on microservices
- Classic examples of C language switch case statement conversion date format
- Redis | very important Middleware
- How to realize 485 wireless communication between multiple sensors and Siemens PLC?
- Classic example of C language - commodity inspection code
- Bean Validation自定义容器验证篇----06
- 網絡系統實驗:ping不通的問題解决
猜你喜欢

Unity metaverse (I). Ready player me & blender customize your Avatar

Memory forensics nssctf otterctf 2018 (replay)

C language: deep analysis of const keyword

Network system experiment: solve the problem of Ping failure

【LeetCode第 83 场双周赛】

Detailed overview of data standards -2022

High number_ Chapter 1 space analytic geometry and vector algebra__ Two point distance

T-seda code

MariaDB database upgrade version

mysql 分支语句case报错
随机推荐
JS related knowledge
[video game training] non contact object size and shape measurement 2020 video game G
Communication module sorting (II) hc-05
EFCore高级Saas系统下单DbContext如何支持不同数据库的迁移
IDEA 热部署(热加载)
JS determines whether the element scrolls to the top
Intelligent video monitoring solutions for elderly care institutions, using new technologies to help the intelligent supervision of nursing homes
An article teaches you the basic use of kubernetes
How to speed up matrix multiplication -- optimizing GEMM (CPU single thread)
Robot dog back submachine gun shooting video fire, netizens shivering: stoooooooopppp!
MySQL data query (select)
Coloring old photos - deoldify get started quickly
落枕如何快速缓解
[the 83rd fortnight of leetcode]
mysql 分支语句case报错
Centernet target detection model and centerfusion fusion target detection model
Classic examples of C language - adding two scores
Design details related to sap e-commerce cloud Spartacus UI store
通信模块整理(二)HC-05
JS drag and drop element