appbaseio / appbaseio/reactivesearch

Vue - AutoScrollTop on pagination not working and pageChange event not emitted

オープン
#1,973 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
JavaScript
スター
4.9k
フォーク
478
PR マージ指標
30日以内にマージされた PR はありません

説明

**Affected Projects**
Vue.JS

**Library Version:**
1.29.0

**Describe the bug**

When clicking on a page number, the ReactiveList component should scroll to top (by default) and should send a pageChange event.
In my case, the scroll is not done and I never get the pageChange event.

I think I found the problem in the code of the /packages/vue/src/components/result/ReactiveList.jsx component:

```
hits(newVal, oldVal) {
this.$emit('data', this.getData());
if (this.shouldRenderPagination) {
// called when page is changed
if (this.isLoading && (oldVal || newVal)) {
if (this.hasPageChangeListener) {
this.$emit('pageChange', this.currentPageState + 1, this.totalPages);
this.$emit('page-change', this.currentPageState + 1, this.totalPages);
} else if (this.scrollOnChange) {
window.scrollTo(0, 0);
}
}

```
I can be wrong but I think that the line
`if (this.isLoading && (oldVal || newVal)) {`

should be

`if (!this.isLoading && (oldVal || newVal)) {`

It's missing a NOT before this.isLoading. Else it will never execute the code that is following the condition because the loading is finished since a while at this time.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。