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

[Bug]: useTable搜索联动时没有重置分页current=1 #499

Closed
NHZEX opened this issue Jun 15, 2024 · 2 comments
Closed

[Bug]: useTable搜索联动时没有重置分页current=1 #499

NHZEX opened this issue Jun 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@NHZEX
Copy link
Contributor

NHZEX commented Jun 15, 2024

软件版本

1.2.3

运行环境

Windows (64)

运行架构

None

重现步骤

use-tablesearch组件用v-model直传参数,查询时没去重置 current = 1,导致结果少于当前页码后表格直接无数据。

而且部分接口返回的current参数是带修正的,total实际分页少于传参current会重置为1,直接导致页面显示空且当前页为1,但实际是api查询非第一页。

考虑使用方案:getData(options?: { resetFirstPage?: boolean })

期望的结果是什么?

应当重置第一页,demo 的虚拟数据无法展示这个逻辑。

实际的结果是什么?

空白且是虚假的第一页

日志记录(可选)

No response

补充说明(可选)

No response

@honghuangdc honghuangdc added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Jun 17, 2024
@honghuangdc
Copy link
Member

提供一个函数 getDataByPageNum

function getDataByPage(pageNum: number = 1) {
  updateSearchParams({ current: pageNum });
  getData();
}

@NHZEX
Copy link
Contributor Author

NHZEX commented Jun 17, 2024

提供一个函数 getDataByPageNum

function getDataByPage(pageNum: number = 1) {
  updateSearchParams({ current: pageNum });
  getData();
}

也可行,没毛病

PS:唯一想到如果有其他没考虑到的场景时会不会导致getDataByXXX膨胀问题?可能还会有选项复用叠加问题(ByXxxAndYyy)。

@NHZEX NHZEX changed the title [Bug]: use-table搜索联动时没有重置分页current=1 [Bug]: useTable搜索联动时没有重置分页current=1 Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants