mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-17 20:55:29 +08:00
fix(activity): pagination blank — coerce total to Number + drop redundant hide-on-single-page
This commit is contained in:
parent
71e75d0e83
commit
895b96a840
@ -98,16 +98,16 @@
|
|||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Element Plus pagination — auto-hidden when results fit a
|
<!-- Element Plus pagination. We use a single guard:
|
||||||
single page (total <= pageSize). User feedback: showing
|
total > pageSize on the wrapper so EP itself doesn't have
|
||||||
pager on a 5-row dataset is noise. -->
|
to negotiate hide-on-single-page (which in EP 2.9.x can
|
||||||
|
return null and leave the .pagination wrapper empty). -->
|
||||||
<div v-if="total > pageSize" class="pagination">
|
<div v-if="total > pageSize" class="pagination">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
v-model:current-page="page"
|
v-model:current-page="page"
|
||||||
v-model:page-size="pageSize"
|
v-model:page-size="pageSize"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page-sizes="[20, 50, 100]"
|
:page-sizes="[20, 50, 100]"
|
||||||
:hide-on-single-page="true"
|
|
||||||
background
|
background
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
@size-change="onPageSizeChange"
|
@size-change="onPageSizeChange"
|
||||||
@ -370,7 +370,11 @@ async function loadEvents() {
|
|||||||
size: pageSize.value,
|
size: pageSize.value,
|
||||||
})
|
})
|
||||||
events.value = res.data?.records || []
|
events.value = res.data?.records || []
|
||||||
total.value = res.data?.total || 0
|
// Force Number coercion — backend sometimes serializes Long as
|
||||||
|
// string (Jackson big-number safety), and 'total > pageSize'
|
||||||
|
// would fall back to string comparison ('30' > 20 → true by
|
||||||
|
// accident, '5' > 20 → also true!). Keep arithmetic numeric.
|
||||||
|
total.value = Number(res.data?.total ?? 0) || 0
|
||||||
} catch {
|
} catch {
|
||||||
events.value = []
|
events.value = []
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user