You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
981 B

3 years ago
  1. /**
  2. * mescroll-body写在子组件时,需通过mescroll的mixins补充子组件缺少的生命周期:
  3. * 当一个页面只有一个mescroll-body写在子组件时, 则使用mescroll-comp.js (参考 mescroll-comp 案例)
  4. * 当一个页面有多个mescroll-body写在子组件时, 则使用mescroll-more.js (参考 mescroll-more 案例)
  5. */
  6. const MescrollCompMixin = {
  7. // 因为子组件无onPageScroll和onReachBottom的页面生命周期,需在页面传递进到子组件
  8. onPageScroll(e) {
  9. let item = this.$refs["mescrollItem"];
  10. if(item && item.mescroll) item.mescroll.onPageScroll(e);
  11. },
  12. onReachBottom() {
  13. let item = this.$refs["mescrollItem"];
  14. if(item && item.mescroll) item.mescroll.onReachBottom();
  15. },
  16. // 当down的native: true时, 还需传递此方法进到子组件
  17. onPullDownRefresh(){
  18. let item = this.$refs["mescrollItem"];
  19. if(item && item.mescroll) item.mescroll.onPullDownRefresh();
  20. }
  21. }
  22. export default MescrollCompMixin;