This commit is contained in:
2026-03-28 14:46:46 +10:00
parent 4e26c3af20
commit ea641e4bd4

View File

@@ -66,6 +66,14 @@ import Stat from "./Stat.vue";
import Time from "./Time.vue"; import Time from "./Time.vue";
import axios from "axios"; import axios from "axios";
// Перенесли props в начало
const props = defineProps({
filter: {
type: String,
default: "all",
},
});
const isDarkMode = ref(document.documentElement.classList.contains("dark")); const isDarkMode = ref(document.documentElement.classList.contains("dark"));
const sentinel = ref(null); const sentinel = ref(null);
const isLoading = ref(false); const isLoading = ref(false);
@@ -216,19 +224,24 @@ watch(poisk, async (newVal) => {
}, 800); }, 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 onfilterItems = (filterValue) => {
const filter = filterValue === "all" ? "default" : filterValue; const filter = filterValue === "all" ? "default" : filterValue;
currentFilter = filter; currentFilter = filter;
loadItems(filter); loadItems(filter);
}; };
const props = defineProps({
filter: {
type: String,
default: "all",
},
});
// Observer для бесконечного скролла // Observer для бесконечного скролла
let observer = null; let observer = null;