mirror of https://github.com/halo-dev/halo-admin
perf: under the list, after deleting all the data on the current page, query the data on the previous page (#557)
Co-authored-by: QuentinHsu <xuquentinyang@gmail.com>pull/559/head
parent
50c178a1c1
commit
1d9ba73d34
|
@ -548,6 +548,11 @@ export default {
|
|||
const { categoryId } = this.list.params
|
||||
this.list.params.categoryId = categoryId === 0 ? undefined : categoryId
|
||||
const response = await apiClient.post.list(this.list.params)
|
||||
if (response.data.content.length === 0 && this.list.params.page > 0) {
|
||||
this.list.params.page--
|
||||
await this.handleListPosts()
|
||||
return
|
||||
}
|
||||
|
||||
this.list.data = response.data.content
|
||||
this.list.total = response.data.total
|
||||
|
|
|
@ -254,6 +254,11 @@ export default {
|
|||
|
||||
const response = await apiClient.attachment.list(this.list.params)
|
||||
|
||||
if (response.data.content.length === 0 && this.list.params.page > 0) {
|
||||
this.list.params.page--
|
||||
await this.handleListAttachments()
|
||||
return
|
||||
}
|
||||
this.list.data = response.data.content
|
||||
this.list.total = response.data.total
|
||||
this.list.hasNext = response.data.hasNext
|
||||
|
|
|
@ -533,6 +533,11 @@ export default {
|
|||
this.list.loading = true
|
||||
|
||||
const response = await apiClient.comment.list(this.targetName, this.list.params)
|
||||
if (response.data.content.length === 0 && this.list.params.page > 0) {
|
||||
this.list.params.page--
|
||||
await this.handleListComments()
|
||||
return
|
||||
}
|
||||
|
||||
this.list.data = response.data.content
|
||||
this.list.total = response.data.total
|
||||
|
|
|
@ -62,7 +62,11 @@
|
|||
{{ item.title }}
|
||||
</a>
|
||||
|
||||
<a herf="javascript:void(0)" v-else-if="item.status === 'DRAFT'" @click="handlePostPreview(item.id)">
|
||||
<a
|
||||
herf="javascript:void(0)"
|
||||
v-else-if="item.status === 'DRAFT'"
|
||||
@click="handlePostPreview(item.id)"
|
||||
>
|
||||
{{ item.title }}
|
||||
</a>
|
||||
|
||||
|
|
|
@ -369,7 +369,11 @@ export default {
|
|||
}
|
||||
|
||||
const { data } = await apiClient.sheet.list(this.list.params)
|
||||
|
||||
if (data.content.length === 0 && this.list.params.page > 0) {
|
||||
this.list.params.page--
|
||||
await this.handleListSheets()
|
||||
return
|
||||
}
|
||||
this.list.data = data.content
|
||||
this.list.total = data.total
|
||||
this.list.hasPrevious = data.hasPrevious
|
||||
|
|
|
@ -265,6 +265,11 @@ export default {
|
|||
this.list.loading = true
|
||||
|
||||
const { data } = await apiClient.journal.list(this.list.params)
|
||||
if (data.content.length === 0 && this.list.params.page > 0) {
|
||||
this.list.params.page--
|
||||
await this.handleListJournals()
|
||||
return
|
||||
}
|
||||
|
||||
this.list.data = data.content
|
||||
this.list.total = data.total
|
||||
|
|
|
@ -227,6 +227,11 @@ export default {
|
|||
apiClient.option
|
||||
.listAsView(this.queryParam)
|
||||
.then(response => {
|
||||
if (response.data.content.length === 0 && this.pagination.page > 0) {
|
||||
this.pagination.page--
|
||||
this.handleListOptions()
|
||||
return
|
||||
}
|
||||
this.options = response.data.content
|
||||
this.pagination.total = response.data.total
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue