z-paging-mixin.js 609 B

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