Skip to content

Commit

Permalink
fix: 🐛 当前页不为1时,修改页数后会导致多次调用getList方法问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ShanYi-Hui committed Dec 13, 2024
1 parent bd19760 commit c89e81c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/hooks/web/useTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ export const useTable = (config: UseTableConfig) => {
const pageSize = ref(10)
const total = ref(0)
const dataList = ref<any[]>([])
let isPageSizeChange = false

watch(
() => currentPage.value,
() => {
methods.getList()
if (!isPageSizeChange) methods.getList()
isPageSizeChange = false
}
)

Expand All @@ -44,6 +46,7 @@ export const useTable = (config: UseTableConfig) => {
methods.getList()
} else {
currentPage.value = 1
isPageSizeChange = true
methods.getList()
}
}
Expand Down

0 comments on commit c89e81c

Please sign in to comment.