ProductCard.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div class="product--card--wrapper">
  3. <div class="product--card" :data-layout="layout" :data-image-position="imagePosition">
  4. <div class="product--card--thumb">
  5. <div class="product--card--thumb--inner">
  6. <!-- <img :src="image" :alt="imageAlt || title" loading="lazy" /> -->
  7. <img :src="image" :alt="title || title" loading="lazy" />
  8. </div>
  9. </div>
  10. <div class="product--card--content">
  11. <h2 v-if="title" class="product--card--title">{{ title }}</h2>
  12. <h3 v-if="subtitle" class="product--card--subtitle" v-html="subtitle"></h3>
  13. <div v-if="description" class="product--card--description">
  14. <p>{{ description }}</p>
  15. </div>
  16. <div v-if="buttonText && buttonUrl" class="product--card--actions">
  17. <NuxtLink :to="buttonUrl" :target="buttonTarget" class="default--round--btn">
  18. {{ buttonText }}
  19. </NuxtLink>
  20. </div>
  21. <div v-if="$slots.actions" class="product--card--actions">
  22. <slot name="actions"></slot>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script setup>
  29. // Props 정의
  30. const props = defineProps({
  31. // 이미지 관련
  32. image: {
  33. type: String,
  34. required: true,
  35. },
  36. imageAlt: {
  37. type: String,
  38. default: "",
  39. },
  40. // 텍스트 관련
  41. title: {
  42. type: String,
  43. required: true,
  44. },
  45. subtitle: {
  46. type: String,
  47. default: "",
  48. },
  49. description: {
  50. type: String,
  51. default: "",
  52. },
  53. // 버튼 관련
  54. buttonText: {
  55. type: String,
  56. default: "",
  57. },
  58. buttonUrl: {
  59. type: String,
  60. default: "/",
  61. },
  62. buttonTarget: {
  63. type: String,
  64. default: "_self",
  65. validator: (value) => ["_self", "_blank"].includes(value),
  66. },
  67. // 레이아웃 옵션
  68. layout: {
  69. type: String,
  70. default: "horizontal", // 'horizontal', 'vertical'
  71. validator: (value) => ["horizontal", "vertical"].includes(value),
  72. },
  73. // 이미지 위치 옵션
  74. imagePosition: {
  75. type: String,
  76. default: "left", // 'left', 'right'
  77. validator: (value) => ["left", "right"].includes(value),
  78. },
  79. });
  80. </script>