Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#1,973 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
frontend

Direzione di ricerca

Inizia da packages/vue/src/components/result/ReactiveList.jsx e analizza il watcher di hits e la relativa condizione di caricamento. Riproduci la paginazione con ReactiveList, quindi verifica che il cambio di pagina scorra verso l’alto per impostazione predefinita ed emetta l’evento pageChange.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

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.

Lingua principale
JavaScript
Stelle
4.9k
Fork
479
Merge medio
4g 10h
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di appbaseio/reactivesearch

Tutte le issue di appbaseio/reactivesearch

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.