feat: WIP add yandex metrika goals

This commit is contained in:
2025-10-26 14:35:39 +03:00
parent fbccd50675
commit 4e59c4e788
19 changed files with 219 additions and 38 deletions

View File

@@ -5,6 +5,7 @@
:hasMore="productsStore.products.meta.hasMore"
:isLoading="productsStore.isLoading"
:isLoadingMore="productsStore.isLoadingMore"
:categoryName="category?.name"
@loadMore="productsStore.loadMore"
/>
</div>
@@ -12,9 +13,11 @@
<script setup>
import ProductsList from "@/components/ProductsList.vue";
import {onMounted} from "vue";
import {onMounted, ref} from "vue";
import {useRoute} from "vue-router";
import {useProductsStore} from "@/stores/ProductsStore.js";
import {useCategoriesStore} from "@/stores/CategoriesStore.js";
import {useYaMetrikaStore} from "@/stores/yaMetrikaStore.js";
defineOptions({
name: 'Products'
@@ -22,12 +25,22 @@ defineOptions({
const route = useRoute();
const productsStore = useProductsStore();
const categoriesStore = useCategoriesStore();
const yaMetrika = useYaMetrikaStore();
const categoryId = route.params.category_id ?? null;
const category = ref(null);
onMounted(async () => {
console.debug("Category Products Mounted");
console.debug("Load products for category: ", categoryId);
console.debug("[Category] Category Products Mounted");
console.debug("[Category] Load products for category: ", categoryId);
category.value = await categoriesStore.findCategoryById(categoryId);
console.debug("[Category] Category Name: ", category.value?.name);
window.document.title = `${category.value?.name ?? 'Неизвестная категория'}`;
yaMetrika.pushHit(route.path, {
title: `${category.value?.name ?? 'Неизвестная категория'}`,
});
if (productsStore.filtersFullUrl === route.fullPath) {
await productsStore.loadProducts(productsStore.filters ?? {