fix: multiple requests when pageSize change and currentPage isn't 1

This commit is contained in:
xiterjia
2022-05-17 23:44:26 +08:00
parent 08bfacc1e8
commit f71a2503bc
2 changed files with 11 additions and 5 deletions

View File

@@ -69,8 +69,13 @@ export const useTable = <T, K, L extends AxiosConfig = AxiosConfig>(
watch(
() => tableObject.pageSize,
() => {
tableObject.currentPage = 1
methods.getList()
// 当前页不为1时修改页数后会导致多次调用getList方法
if (tableObject.currentPage === 1) {
methods.getList()
} else {
tableObject.currentPage = 1
methods.getList()
}
}
)