fix: multiple requests when pageSize change and currentPage isn't 1
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user