ProductCard.vue 3.1 KB

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