| | |
| | | /** |
| | | * 数据加载监听 |
| | | * 数据加载状态监听 |
| | | * @see './b_loadingToast.js' 和 '../../component/loadingstatus' |
| | | */ |
| | | module.exports = Behavior({ |
| | | data: { |
| | |
| | | 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({ |