Giter Site home page Giter Site logo

当容器内有子容器 overflow:auto 当滚动子容器的时候 会触发onRefresh 导致子容器内部无法正常滚动 about m-pull-to-refresh HOT 2 OPEN

react-component avatar react-component commented on July 21, 2024
当容器内有子容器 overflow:auto 当滚动子容器的时候 会触发onRefresh 导致子容器内部无法正常滚动

from m-pull-to-refresh.

Comments (2)

appLhui avatar appLhui commented on July 21, 2024
  // 判断是否是属于下拉刷新
  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;
  }

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

from m-pull-to-refresh.

sunjianfengHub avatar sunjianfengHub commented on July 21, 2024

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

from m-pull-to-refresh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.