From eb7366f400867d3f401fe60f06d848d6d1448457 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 17 十月 2022 17:41:56 +0800
Subject: [PATCH] 2022.10.17
---
base/behaviors/b_loadingStatus.js | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/base/behaviors/b_loadingStatus.js b/base/behaviors/b_loadingStatus.js
index ad6bf06..ec08a60 100644
--- a/base/behaviors/b_loadingStatus.js
+++ b/base/behaviors/b_loadingStatus.js
@@ -1,22 +1,37 @@
/**
- * 鏁版嵁鍔犺浇鐩戝惉
+ * 鏁版嵁鍔犺浇鐘舵�佺洃鍚�
+ * @see './b_loadingToast.js' 鍜� '../../component/loadingstatus'
*/
module.exports = Behavior({
data: {
cPage: 1,
tPage: 1,
+ perPage: 10,
totalCount: 0,
loading: false,
- needLoadMore: false
+ needLoadMore: false,
+ timeout: false
},
+ timeoutId: '',
+ lastLoading: false,
observers: {
'loading': function (loading) {
+ if (this.lastLoading == loading) return
if (loading) {
+ clearTimeout(this.timeoutId)
this._loadStart()
this._loading()
+ this.timeoutId = setTimeout(() => {
+ this.setData({
+ loading: false,
+ timeout: true
+ })
+ }, 10000);
} else {
+ clearTimeout(this.timeoutId)
this._loadComplete()
}
+ this.lastLoading = loading
},
'cPage, tPage': function (cPage, tPage) {
this.setData({
@@ -31,7 +46,7 @@
},
methods: {
_onReachBottom() {
- console.log('_onReachBottom');
+ // console.log('_onReachBottom');
let {cPage, tPage, loading} = this.data
if (!loading && cPage < tPage) {
if (typeof this.loadmore === 'function') {
@@ -59,6 +74,6 @@
if (typeof this.loadComplete === 'function') {
this.loadComplete()
}
- }
+ },
}
})
\ No newline at end of file
--
Gitblit v1.9.3