wip: crud table

This commit is contained in:
张传龙
2022-09-03 17:33:20 +08:00
parent 661aed1a94
commit d1dd58215d
3 changed files with 54 additions and 39 deletions

View File

@@ -65,10 +65,14 @@ export default [
const { title, pageNo, pageSize } = data.query
let pageData = []
let total = 60
const filterData = posts.filter((item) => item.title.includes(title))
const filterData = posts.filter((item) => item.title.includes(title) || (!title && title !== 0))
if (filterData.length) {
while (pageData.length < pageSize) {
pageData.push(filterData[Math.round(Math.random() * (filterData.length - 1))])
if (pageSize) {
while (pageData.length < pageSize) {
pageData.push(filterData[Math.round(Math.random() * (filterData.length - 1))])
}
} else {
pageData = filterData
}
pageData = pageData.map((item, index) => ({
id: pageSize * (pageNo - 1) + index + 1,