11<template >
2- <div v-if =" data?.product" >
2+ <template v-if =" data ?.product " >
33 <section >
44 <div class =" container flex flex-wrap items-center pt-4 pb-12 mx-auto" >
55 <div class =" grid grid-cols-1 gap-4 mt-8 lg:grid-cols-2 xl:grid-cols-2 md:grid-cols-2 sm:grid-cols-2" >
1818 <p v-if =" data.product.variations" class =" pt-1 mt-4 text-xl text-gray-900" >
1919 <span class =" py-2" >Varianter</span >
2020 <select id =" variant" name =" variant"
21- class =" block w-64 px-6 py-2 bg-white border border-gray-500 rounded-lg focus:outline-none focus:shadow-outline" >
21+ class =" block w-64 px-6 py-2 bg-white border border-gray-500 rounded-lg focus:outline-none focus:shadow-outline"
22+ v-model =" selectedVariation" >
2223 <option v-for =" (variation, index) in data.product.variations.nodes" :key =" variation.databaseId"
2324 :value =" variation.databaseId" :selected =" index === 0" >
2425 {{ filteredVariantName(data.product.name, variation.name) }}
3435 </div >
3536 </div >
3637 </section >
37- </div >
38+ </template >
3839</template >
3940
4041<script setup>
@@ -53,19 +54,16 @@ import ADD_TO_CART_MUTATION from "@/apollo/mutations/ADD_TO_CART_MUTATION.gql";
5354import ProductImage from " @/components/Products/ProductImage.vue" ;
5455import ProductPrice from " @/components/Products/ProductPrice.vue" ;
5556
56- import {
57- stripHTML ,
58- filteredVariantPrice ,
59- filteredVariantName ,
60- hasVariations ,
61- } from " @/utils/functions" ;
57+ import { stripHTML , filteredVariantName } from " @/utils/functions" ;
6258
6359import { useCart } from " @/store/useCart" ;
6460
6561const isLoading = useState (" isLoading" , () => false );
6662
6763const cart = useCart ();
6864
65+ const selectedVariation = ref (null )
66+
6967const props = defineProps ({
7068 id: { type: String , required: true },
7169 slug: { type: String , required: true },
0 commit comments