From ea641e4bd4c69b23b05ad0ebf4f91f55db06e31b Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 28 Mar 2026 14:46:46 +1000 Subject: [PATCH] wath --- src/components/Section.vue | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/components/Section.vue b/src/components/Section.vue index c766930..ba799fd 100644 --- a/src/components/Section.vue +++ b/src/components/Section.vue @@ -66,6 +66,14 @@ import Stat from "./Stat.vue"; import Time from "./Time.vue"; import axios from "axios"; +// Перенесли props в начало +const props = defineProps({ + filter: { + type: String, + default: "all", + }, +}); + const isDarkMode = ref(document.documentElement.classList.contains("dark")); const sentinel = ref(null); const isLoading = ref(false); @@ -216,19 +224,24 @@ watch(poisk, async (newVal) => { }, 800); }); +// ✅ Добавлен watch для обновления данных при изменении filter +watch( + () => props.filter, + async (newFilter) => { + const filterValue = newFilter === "all" ? "default" : newFilter; + currentFilter = filterValue; + // Очищаем поиск при смене фильтра + poisk.value = ""; + await loadItems(filterValue); + }, +); + const onfilterItems = (filterValue) => { const filter = filterValue === "all" ? "default" : filterValue; currentFilter = filter; loadItems(filter); }; -const props = defineProps({ - filter: { - type: String, - default: "all", - }, -}); - // Observer для бесконечного скролла let observer = null;