<script setup>
const route = useRoute();

const id = computed(() => {
  if(route.params.id){
    return route.params.id;
  }
  return 0;
})

// 取得產品資料
const { data: prodRes } = await useMyFetch('/product/getProduct', "GET", { id })
const prodData = computed(() => prodRes.value.data);

</script>

<template>
  <div class="content">
    <div class="block">
      <div class="bName">{{prodData.name}}</div>
      <div class="bDesc mb-3">{{prodData.description}}</div>
      <div class="imgCnt mb-3" style="width: 33%">
          <img :src="prodData.imageurl" :alt="prodData.name">
      </div>
      <div class="bDesc mb-5 ck-content" v-html="prodData.content">
      </div>      
      <div class="d-flex justify-content-end">
          <a class="backBtn" href="javascript:;" @click="$router.back()" >back</a>
      </div>
    </div>
  </div>
</template>

<style lang="less">

</style>
