1. 程式人生 > 實用技巧 >uni-app做下拉重新整理

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/