mirror of
https://github.com/halo-dev/halo.git
synced 2025-12-20 16:44:38 +08:00
Refactor filter status values to use string type (#7873)
#### What type of PR is this? /area ui /kind bug /milestone 2.22.x #### What this PR does / why we need it: Fix comment and plugin list filtering not working correctly This issue might have been caused by the VueUse dependency upgrade in #7819. #### Does this PR introduce a user-facing change? ```release-note None ```
This commit is contained in:
@@ -36,14 +36,7 @@ const pluginInstallationModalVisible = ref(false);
|
||||
|
||||
const keyword = useRouteQuery<string>("keyword", "");
|
||||
|
||||
const selectedEnabledValue = useRouteQuery<
|
||||
string | undefined,
|
||||
boolean | undefined
|
||||
>("enabled", undefined, {
|
||||
transform: (value) => {
|
||||
return value ? value === "true" : undefined;
|
||||
},
|
||||
});
|
||||
const selectedEnabledValue = useRouteQuery<string | undefined>("enabled");
|
||||
const selectedSortValue = useRouteQuery<string | undefined>("sort");
|
||||
|
||||
const hasFilters = computed(() => {
|
||||
@@ -64,7 +57,9 @@ const { data, isLoading, isFetching, refetch } = useQuery<Plugin[]>({
|
||||
page: 0,
|
||||
size: 0,
|
||||
keyword: keyword.value,
|
||||
enabled: selectedEnabledValue.value,
|
||||
enabled: selectedEnabledValue.value
|
||||
? JSON.parse(selectedEnabledValue.value)
|
||||
: undefined,
|
||||
sort: [selectedSortValue.value].filter(Boolean) as string[],
|
||||
});
|
||||
|
||||
@@ -251,11 +246,11 @@ onMounted(() => {
|
||||
},
|
||||
{
|
||||
label: t('core.plugin.filters.status.items.active'),
|
||||
value: true,
|
||||
value: 'true',
|
||||
},
|
||||
{
|
||||
label: t('core.plugin.filters.status.items.inactive'),
|
||||
value: false,
|
||||
value: 'false',
|
||||
},
|
||||
]"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user