added suspense in cart layout

This commit is contained in:
Mamalizz
2025-03-18 16:23:19 +03:30
parent 095f53e7cd
commit ba7cdee9b0
+11 -9
View File
@@ -12,7 +12,9 @@ const prevPage = computed(() => route.meta.prevPage);
// queries // queries
const { data: cart } = useGetCartOrders(); const { data: cart, isPending: cartIsPending, suspense } = useGetCartOrders();
await suspense();
// computed // computed
@@ -27,12 +29,13 @@ const hasCartItem = computed(
dir="rtl" dir="rtl"
> >
<Header /> <Header />
<main <main
class="w-full overflow-x-hidden container flex flex-col gap-[5rem] max-w-[80vw]" class="w-full overflow-x-hidden flex flex-col gap-[5rem] lg:max-w-[85vw]"
> >
<div class="w-full flex flex-col"> <div class="w-full flex flex-col container">
<div <div
class="flex flex-col items-center justify-center gap-4 py-[5rem] lg:gap-0 lg:flex-row" class="flex flex-col items-center justify-center py-[3.5rem] lg:py-[5rem] gap-5 lg:gap-0 lg:flex-row"
> >
<div <div
class="flex items-center justify-start w-full lg:w-3/12" class="flex items-center justify-start w-full lg:w-3/12"
@@ -53,7 +56,7 @@ const hasCartItem = computed(
</div> </div>
<h1 <h1
class="w-full text-center typo-h-3 lg:w-6/12 title-large" class="w-full text-center lg:w-6/12 typo-h-5 lg:typo-h-4"
> >
{{ pageTitle }} {{ pageTitle }}
</h1> </h1>
@@ -61,7 +64,7 @@ const hasCartItem = computed(
<div class="hidden w-3/12 shrink-0 lg:block">&nbsp;</div> <div class="hidden w-3/12 shrink-0 lg:block">&nbsp;</div>
</div> </div>
<div <div
class="w-full flex flex-col items-center relative justify-between gap-8 lg:gap-6 lg:flex-row lg:items-start" class="w-full flex flex-col items-center relative justify-between gap-4 lg:gap-6 lg:flex-row lg:items-start"
> >
<div <div
class="flex flex-col w-full gap-4 lg:gap-6 shrink-0" class="flex flex-col w-full gap-4 lg:gap-6 shrink-0"
@@ -69,11 +72,10 @@ const hasCartItem = computed(
> >
<NuxtPage /> <NuxtPage />
</div> </div>
<CartSummary v-if="hasCartItem && !cartIsPending" />
<CartSummary v-if="hasCartItem" />
</div> </div>
</div> </div>
<ProductsSlider title="دیگران این محصولات را هم خریده‌اند" /> <ProductsSlider title="دیگر محصولات" />
</main> </main>
<div class="w-full flex-col flex mt-20"> <div class="w-full flex-col flex mt-20">
<ServiceHighlights /> <ServiceHighlights />