mirror of
https://github.com/m1ngsama/FUJI.git
synced 2025-12-24 10:51:27 +00:00
fix page
This commit is contained in:
parent
91666db1d7
commit
bd38b8ed2b
1 changed files with 11 additions and 9 deletions
|
|
@ -304,21 +304,23 @@ export default function App() {
|
|||
},
|
||||
})
|
||||
|
||||
const filteredList = useMemo(() => {
|
||||
if (statusFilter.length > 0) {
|
||||
return list.items.filter(item => statusFilter.includes(item.status))
|
||||
}
|
||||
return list.items
|
||||
}, [list, statusFilter])
|
||||
|
||||
const items = useMemo(() => {
|
||||
const start = (page - 1) * rowsPerPage
|
||||
const end = start + rowsPerPage
|
||||
|
||||
if (statusFilter.length > 0) {
|
||||
return list.items.filter(item => statusFilter.includes(item.status)).slice(start, end)
|
||||
}
|
||||
|
||||
return list.items.slice(start, end)
|
||||
}, [list, page, rowsPerPage, statusFilter])
|
||||
return filteredList.slice(start, end)
|
||||
}, [filteredList, page, rowsPerPage])
|
||||
|
||||
const pages = useMemo(() => {
|
||||
return Math.ceil(list.items.length / rowsPerPage)
|
||||
}, [list, rowsPerPage])
|
||||
|
||||
return Math.ceil(filteredList.length / rowsPerPage)
|
||||
}, [filteredList, rowsPerPage])
|
||||
// useEffect(() => {
|
||||
// fetchAndSetEvent()
|
||||
// }, [])
|
||||
|
|
|
|||
Loading…
Reference in a new issue