UNI-APP_uni-app下拉刷新,uni-app上拉加载

pages.js 文件开启

在这里插入图片描述

"enablePullDownRefresh": true

生命周期函数

在这里插入图片描述

//上拉触底生命周期
onReachBottom(){
    
    
     console.log("触底了")
 },
 //下拉生命周期
 onPullDownRefresh() {
    
    
     console.log('下拉刷新');
     setTimeout(function () {
    
    
         uni.stopPullDownRefresh();  //关闭下拉刷新
     }, 1000);
 },

页面加载调用下拉刷新

onLoad(options) {
    
    
    uni.startPullDownRefresh({
    
    
        success:function(res){
    
    
            console.log(res);  //success 返回参数说明
        }
    });  //这里表示当进入页面的时候就开始执行下拉刷新动画
},

猜你喜欢

转载自blog.csdn.net/weixin_44599931/article/details/108995477