fix: page size

This commit is contained in:
Fine 2023-10-23 17:23:09 +08:00
parent b8afdd167e
commit 5b2465d862

View File

@ -16,7 +16,7 @@ limitations under the License. -->
<div class="title"> <div class="title">
<span class="mr-5">Trace Segments</span> <span class="mr-5">Trace Segments</span>
<el-popover <el-popover
:width="315" :width="310"
placement="right" placement="right"
:content="t('traceDesc')" :content="t('traceDesc')"
:popper-style="{ 'word-break': 'keep-all', 'word-wrap': 'break-word' }" :popper-style="{ 'word-break': 'keep-all', 'word-wrap': 'break-word' }"
@ -73,7 +73,6 @@ limitations under the License. -->
:page-size="pageSize" :page-size="pageSize"
:small="true" :small="true"
layout="prev, pager, next" layout="prev, pager, next"
:pager-count="5"
:total="total" :total="total"
@current-change="updatePage" @current-change="updatePage"
/> />
@ -95,11 +94,11 @@ limitations under the License. -->
const traceStore = useTraceStore(); const traceStore = useTraceStore();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
const selectedKey = ref<string>(""); const selectedKey = ref<string>("");
const pageSize = ref<number>(20); const pageSize = 20;
const total = computed(() => const total = computed(() =>
traceStore.traceList.length === pageSize.value traceStore.traceList.length === pageSize
? pageSize.value * traceStore.conditions.paging.pageNum + 1 ? pageSize * traceStore.conditions.paging.pageNum + 1
: pageSize.value * traceStore.conditions.paging.pageNum, : pageSize * traceStore.conditions.paging.pageNum,
); );
function searchTrace() { function searchTrace() {
@ -110,7 +109,7 @@ limitations under the License. -->
function updatePage(p: number) { function updatePage(p: number) {
traceStore.setTraceCondition({ traceStore.setTraceCondition({
paging: { pageNum: p, pageSize: pageSize.value }, paging: { pageNum: p, pageSize },
}); });
searchTrace(); searchTrace();
} }
@ -118,7 +117,7 @@ limitations under the License. -->
function changeSort(opt: Option[]) { function changeSort(opt: Option[]) {
traceStore.setTraceCondition({ traceStore.setTraceCondition({
queryOrder: opt[0].value, queryOrder: opt[0].value,
paging: { pageNum: 1, pageSize: pageSize.value }, paging: { pageNum: 1, pageSize },
}); });
searchTrace(); searchTrace();
} }