uni-app做下拉刷新

{
  "path": "pages/activities/bargain",
       "style": {
             "navigationBarTitleText": "",
                "navigationStyle": "custom",
                "enablePullDownRefresh": true,//是否开启页面刷新
                "app-plus": {
                "bounce": "none" //关闭窗口回弹效果
                }
     }
},
这是uni-app项目里自带的pages.json,就是页面的
        onLoad(option) {
            setTimeout(function () {  //设置了定时器
                console.log('start pulldown');
            }, 1000);  //毫秒
            uni.startPullDownRefresh({
                success: res => {  //箭头函数
                    this.orderId = option.orderId
                    this.orderSn = option.orderSn
                    this.shareTime = option.time
                    if (!this.shareTime) {
                        this.addShareTime()
                    }
                    this.getBarginData()    //调用这个接口
                    console.log(res); //success 返回参数说明
                }
            }); //这里表示当进入页面的时候就开始执行下拉刷新动画
        },
        onPullDownRefresh() {
            if (this.orderId) {
                if (!this.shareTime) {
                    this.addShareTime()
                }
                this.getBarginData()    //调用接口
            }
            //监听下拉刷新动作的执行方法,每次手动下拉刷新都会执行一次
            console.log('refresh');
            setTimeout(function () {
                uni.stopPullDownRefresh();  //停止下拉刷新动画
            }, 1000);
        },

 

今天新知道了一个网站,可以压缩图片的大小  https://tinypng.com/

posted @ 2021-01-09 18:24  温柔本肉  阅读(646)  评论(0编辑  收藏  举报