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

ScrollView初始化成功后,不会自动触发上拉加载,已使用immediate-check-end-reaching #335

Closed
skyshirt opened this issue Feb 25, 2019 · 0 comments

Comments

@skyshirt
Copy link

Mand Mobile Version

2.1.1

OS Version & Browser Version

windows 10 64位
Chrome 版本 72.0.3626.119(正式版本) (64 位)

Node Version, Package Management Tool

node v10.14.0
npm 6.8.0

Recurring Links

抱歉,网速慢,打不开codesandbox,配置如下

<md-scroll-view
  ref="scrollView"
  :scrolling-x="false"
  immediate-check-end-reaching
  @refreshing="$_onRefresh"
  @endReached="$_onEndReached"
>

Recurring Steps

使用scrollview新增属性immediateCheckEndReaching,并没有解决上拉加载的问题

Expectant Behaviors

使用了immediateCheckEndReaching参数后
ScrollView初始化成功后,可以自动触发@endReached()事件

看了下源码,应该是endOffset计算错误
Math.abs(endOffset) < 50

$_checkScrollerEnd() {
      if (!this.scroller) {
        return
      }
      const containerHeight = this.scroller._clientHeight
      const content = this.scroller._contentHeight
      const top = this.scroller._scrollTop
      const moreOffsetY = this.moreOffsetY
      const moreThreshold = this.endReachedThreshold
      const endOffset = content - containerHeight - (top + moreOffsetY + moreThreshold)
      if (
        top >= 0 &&
        !this.isEndReaching &&
        endOffset <= 0 &&
        (this.bouncing && Math.abs(endOffset) < 50) &&
        this.endReachedHandler
      ) {
        this.endReachedHandler()
      }
    }
xxyan0205 added a commit that referenced this issue Mar 12, 2019
use ref name to look up a component instance in context instead of passing a reference directly

#335
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