mirror of https://github.com/halo-dev/halo
feat: display total items text for plugins list (#4500)
#### What type of PR is this? /area console /kind improvement /milestone 2.9.x #### What this PR does / why we need it: 在 https://github.com/halo-dev/halo/pull/4473 中移除了插件管理的分页功能,但可能会造成列表底部看起来不协调,所以恢复总条数的文字显示。 #### Which issue(s) this PR fixes: Fixes #4498 #### Does this PR introduce a user-facing change? ```release-note None ```pull/4460/head^2
parent
24d1d9460c
commit
e7f53fad05
|
@ -52,6 +52,8 @@ function handleClearFilters() {
|
||||||
selectedEnabledValue.value = undefined;
|
selectedEnabledValue.value = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const total = ref(0);
|
||||||
|
|
||||||
const { data, isLoading, isFetching, refetch } = useQuery<Plugin[]>({
|
const { data, isLoading, isFetching, refetch } = useQuery<Plugin[]>({
|
||||||
queryKey: ["plugins", keyword, selectedEnabledValue, selectedSortValue],
|
queryKey: ["plugins", keyword, selectedEnabledValue, selectedSortValue],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
@ -62,6 +64,9 @@ const { data, isLoading, isFetching, refetch } = useQuery<Plugin[]>({
|
||||||
enabled: selectedEnabledValue.value,
|
enabled: selectedEnabledValue.value,
|
||||||
sort: [selectedSortValue.value].filter(Boolean) as string[],
|
sort: [selectedSortValue.value].filter(Boolean) as string[],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
total.value = data.total;
|
||||||
|
|
||||||
return data.items;
|
return data.items;
|
||||||
},
|
},
|
||||||
keepPreviousData: true,
|
keepPreviousData: true,
|
||||||
|
@ -304,6 +309,14 @@ onMounted(() => {
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</Transition>
|
</Transition>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div class="flex h-8 items-center">
|
||||||
|
<span class="text-sm text-gray-500">
|
||||||
|
{{ $t("core.components.pagination.total_label", { total: total }) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</VCard>
|
</VCard>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue