wath
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user