Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#1,973 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu trong packages/vue/src/components/result/ReactiveList.jsx và kiểm tra watcher của hits cùng điều kiện loading của nó. Tái hiện phân trang bằng ReactiveList, sau đó xác minh rằng việc chuyển trang sẽ cuộn lên đầu theo mặc định và phát ra sự kiện pageChange.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
JavaScript
Star
4.9k
Fork
479
Merge trung bình
4 ngày 10 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của appbaseio/reactivesearch

Tất cả issue của appbaseio/reactivesearch

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.