z-paging-mixin.js 614 B

1234567891011121314151617181920212223
  1. // [z-paging]使用页面滚动时引入此mixin,用于监听和处理onPullDownRefresh等页面生命周期方法
  2. export default {
  3. onPullDownRefresh() {
  4. if (this.isPagingRefNotFound()) return;
  5. this.$refs.paging.reload().catch(() => {});
  6. },
  7. onPageScroll(e) {
  8. if (this.isPagingRefNotFound()) return;
  9. this.$refs.paging.updatePageScrollTop(e.scrollTop);
  10. e.scrollTop < 10 && this.$refs.paging.doChatRecordLoadMore();
  11. },
  12. onReachBottom() {
  13. if (this.isPagingRefNotFound()) return;
  14. this.$refs.paging.pageReachBottom();
  15. },
  16. methods: {
  17. isPagingRefNotFound() {
  18. return !this.$refs.paging;
  19. }
  20. }
  21. }