This commit is contained in:
Parsa Nazer
2026-02-26 16:57:26 +03:30
+6 -8
View File
@@ -28,14 +28,12 @@ const mainCategoriesMenu = computed(() => {
const filteredCategories = computed(() => { const filteredCategories = computed(() => {
if (categories.value) { if (categories.value) {
return categories.value return categories.value
.filter((mainCategory) => {
if (selectedCategory.value === "همه دسته ها") return true;
return mainCategory.name === selectedCategory.value;
})
.flatMap((mainCategory) => mainCategory.subcategorys) .flatMap((mainCategory) => mainCategory.subcategorys)
.filter((category) => { .filter((category) => category.name.includes(debouncedSearch.value));
if (selectedCategory.value === "همه دسته ها") {
return category.name.includes(debouncedSearch.value);
}
return category.name.includes(debouncedSearch.value) && category.parent === selectedCategory.value;
});
} }
return []; return [];
}); });
@@ -61,7 +59,7 @@ if (response.isError) {
<div class="w-full flex items-center justify-between lg:justify-end gap-4"> <div class="w-full flex items-center justify-between lg:justify-end gap-4">
<Input <Input
placeholder="جست و جو محصول ..." placeholder="جست و جو دسته بندی ..."
v-model="search" v-model="search"
variant="outlined" variant="outlined"
class="!rounded-xl w-full lg:w-8/12" class="!rounded-xl w-full lg:w-8/12"