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

pagination 请求两次问题 #3128

Open
lufei9527 opened this issue Apr 21, 2020 · 5 comments
Open

pagination 请求两次问题 #3128

lufei9527 opened this issue Apr 21, 2020 · 5 comments

Comments

@lufei9527
Copy link

Bug report(问题描述)

Steps to reproduce(问题复现步骤)

Screenshot or Gif(截图或动态图)

image

Link to minimal reproduction(最小可在线还原demo)

Other relevant information(格外信息)

  • Your OS:
  • Node.js version:
  • vue-element-admin version:
@lufei9527
Copy link
Author

当我们请求API的时候,例如API返回总数为456条,我们按照10条每页,一共有46页。当我们选了6之后的页数之后,然后把size选择成100条(目的就是让current * size > total),这个时候,分页就会同时触发size选择函数以及current选择函数。

@yingzi2019
Copy link

当我们请求API的时候,例如API返回总数为456条,我们按照10条每页,一共有46页。当我们选了6之后的页数之后,然后把size选择成100条(目的就是让current * size > total),这个时候,分页就会同时触发size选择函数以及current选择函数。
按照逻辑,更改了pageSize之后,不是应该进行第一页的跳转么?

@dingangang
Copy link
Contributor

这个要手动操作了。 更改pageSize之后。一般会把current重设为1然后重新拉取数据吧?

@Alexlin96
Copy link

使用函数防抖,再触发请求方法

@yuenu
Copy link

yuenu commented Feb 15, 2023

 handleSizeChange(val) {
      this.currentPage = 1   // add this line, 切換頁面時將currentPage重置為1
      this.$emit('pagination', { page: this.currentPage, limit: val })
      if (this.autoScroll) {
        scrollTo(0, 800)
      }
    },

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

5 participants