Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
appLhui opened this issue Sep 10, 2018 · 2 comments

Comments

@appLhui
Copy link

appLhui commented Sep 10, 2018

No description provided.

@appLhui
Copy link
Author

appLhui commented Sep 10, 2018

  // 判断是否是属于下拉刷新
  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;
  }

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

@biubiubiu-max
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants