ProductCard.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. <h4 v-if="smallTitle" class="product--card--smalltitle">{{ smallTitle }}</h4>
  13. <h3 v-if="subtitle" class="product--card--subtitle" v-html="subtitle"></h3>
  14. <div v-if="description" class="product--card--description">
  15. <p>{{ description }}</p>
  16. </div>
  17. <div v-if="buttonText && buttonUrl" class="product--card--actions">
  18. <NuxtLink
  19. :to="buttonUrl"
  20. :target="buttonTarget"
  21. class="default--round--btn"
  22. :class="{ reverse: btnreverse == 0 }"
  23. >
  24. {{ buttonText }}
  25. </NuxtLink>
  26. <NuxtLink
  27. v-if="buttonText2"
  28. :to="buttonUrl2"
  29. :target="buttonTarget2"
  30. class="default--round--btn"
  31. :class="{ reverse: btnreverse == 1 }"
  32. >
  33. {{ buttonText }}
  34. </NuxtLink>
  35. </div>
  36. <div v-if="smallDescription" class="product--card--small--description">
  37. <p v-html="smallDescription"></p>
  38. </div>
  39. <div v-if="$slots.actions" class="product--card--actions">
  40. <slot name="actions"></slot>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script setup>
  47. // Props 정의
  48. const props = defineProps({
  49. // 이미지 관련
  50. image: {
  51. type: String,
  52. required: true,
  53. },
  54. imageAlt: {
  55. type: String,
  56. default: "",
  57. },
  58. btnreverse: {
  59. type: Number,
  60. default: "",
  61. },
  62. // 텍스트 관련
  63. title: {
  64. type: String,
  65. required: true,
  66. },
  67. smallTitle: {
  68. type: String,
  69. },
  70. subtitle: {
  71. type: String,
  72. default: "",
  73. },
  74. description: {
  75. type: String,
  76. default: "",
  77. },
  78. smallDescription: {
  79. type: String,
  80. default: "",
  81. },
  82. // 버튼 관련
  83. buttonText: {
  84. type: String,
  85. default: "",
  86. },
  87. buttonUrl: {
  88. type: String,
  89. default: "/",
  90. },
  91. buttonTarget: {
  92. type: String,
  93. default: "_self",
  94. validator: (value) => ["_self", "_blank"].includes(value),
  95. },
  96. // 버튼 관련
  97. buttonText2: {
  98. type: String,
  99. default: "",
  100. },
  101. buttonUrl2: {
  102. type: String,
  103. default: "/",
  104. },
  105. buttonTarget2: {
  106. type: String,
  107. default: "_self",
  108. validator: (value) => ["_self", "_blank"].includes(value),
  109. },
  110. // 레이아웃 옵션
  111. layout: {
  112. type: String,
  113. default: "horizontal", // 'horizontal', 'vertical'
  114. validator: (value) => ["horizontal", "vertical"].includes(value),
  115. },
  116. // 이미지 위치 옵션
  117. imagePosition: {
  118. type: String,
  119. default: "left", // 'left', 'right'
  120. validator: (value) => ["left", "right"].includes(value),
  121. },
  122. });
  123. </script>