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