m-pull-to-refresh icon indicating copy to clipboard operation
m-pull-to-refresh copied to clipboard

当容器内有子容器 overflow:auto 当滚动子容器的时候 会触发onRefresh 导致子容器内部无法正常滚动

Open appLhui opened this issue 6 years ago • 2 comments

appLhui avatar Sep 10 '18 08:09 appLhui

  // 判断是否是属于下拉刷新
  isPullToRefresh(el) {
    if (el.scrollTop == 0) {
      if (el.className.indexOf('rmc-pull-to-refresh') > -1) {
        return true;
      }else{
        return this.isPullToRefresh(el.parentElement);
      }
    }else{
      return false;
    }
  }

  onTouchStart = (_ele, e) => {

    if(!this.isPullToRefresh(e.target)) return;
    this._ScreenY = this._startScreenY = e.touches[0].screenY;
    // 一开始 refreshing 为 true 时 this._lastScreenY 有值
    this._lastScreenY = this._lastScreenY || 0;
  }

因为我是只需要向下拉刷新,所以我就在作者代码里加了这个判断 ,基本已经解决了这个问题

appLhui avatar Sep 10 '18 11:09 appLhui

我在子组建上先向上滑动了,然后向下划动,但是此时会触发下拉刷新,我目标是希望子容器达到顶部的时候才可以出发下拉,您看您是否有办法帮助我度过难关

biubiubiu-max avatar May 21 '21 01:05 biubiubiu-max