riku
2022-10-12 741d1f7b2e2ac1c3f89d80dfac7625e3427e2367
base/behaviors/b_loadingStatus.js
@@ -1,10 +1,12 @@
/**
 * 数据加载监听
 * 数据加载状态监听
 * @see './b_loadingToast.js' 和 '../../component/loadingstatus'
 */
module.exports = Behavior({
  data: {
    cPage: 1,
    tPage: 1,
    perPage: 10,
    totalCount: 0,
    loading: false,
    needLoadMore: false
@@ -14,6 +16,7 @@
      if (loading) {
        this._loadStart()
        this._loading()
        setTimeout(() => { this.setData({loading: false}) }, 20000);
      } else {
        this._loadComplete()
      }
@@ -31,7 +34,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 +62,6 @@
      if (typeof this.loadComplete === 'function') {
        this.loadComplete()
      }
    }
    },
  }
})