This commit is contained in:
marzban-dev
2025-04-16 22:13:38 +03:30
parent ff96202fe6
commit b9a8ee6284
+10 -10
View File
@@ -1,5 +1,4 @@
<script lang="ts" setup> <script lang="ts" setup>
// import // import
import ChatButton from "~/components/product/ChatBox/ChatButton.vue"; import ChatButton from "~/components/product/ChatBox/ChatButton.vue";
@@ -18,18 +17,20 @@ const { suspense: suspenseComments } = useGetComments(id, page);
const selectedVariant = ref<ProductVariant>(); const selectedVariant = ref<ProductVariant>();
const showChatButton = ref(true);
// type // type
export type ProductVariantProvideType = { export type ProductVariantProvideType = {
selectedVariant: typeof selectedVariant, selectedVariant: typeof selectedVariant;
changeSelectedVariant: (value: ProductVariant) => void changeSelectedVariant: (value: ProductVariant) => void;
} };
// provide / inject // provide / inject
provide("productVariant", { provide("productVariant", {
selectedVariant, selectedVariant,
changeSelectedVariant: (value: ProductVariant) => selectedVariant.value = value changeSelectedVariant: (value: ProductVariant) => (selectedVariant.value = value),
}); });
// ssr // ssr
@@ -40,22 +41,21 @@ const commentsResponse = await suspenseComments();
if (productResponse.isError || commentsResponse.isError) { if (productResponse.isError || commentsResponse.isError) {
throw createError({ throw createError({
statusCode: 404, statusCode: 404,
statusMessage: `error : product ${id} prefetch error` statusMessage: `error : product ${id} prefetch error`,
}); });
} }
</script> </script>
<template> <template>
<div class="w-full flex flex-col "> <div class="w-full flex flex-col">
<ProductHero /> <ProductHero />
<ProductVideo /> <ProductVideo v-model:showChatButton="showChatButton" />
<ProductComments /> <ProductComments />
<ProductDetails /> <ProductDetails />
<ProductsGrid <ProductsGrid
title="محصولات مشابه" title="محصولات مشابه"
:products="product!.related_products" :products="product!.related_products"
/> />
<ChatButton /> <ChatButton :showChatButton="showChatButton" />
</div> </div>
</template> </template>