fullSizeBannerText1.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <section
  3. class="img--section--full"
  4. :data-type="type"
  5. :data-text-location="textLocation"
  6. >
  7. <div :style="{ height: height + 'px' }">
  8. <picture>
  9. <source media="(max-width: 768px)" :srcset="`${imagePath}?width=768`" />
  10. <source media="(max-width: 1024px)" :srcset="`${imagePath}?width=1024`" />
  11. <source media="(max-width: 1440px)" :srcset="`${imagePath}?width=1440`" />
  12. <source media="(min-width: 1440px)" :srcset="`${imagePath}?width=1920`" />
  13. <img data-object-fit="true" :src="imagePath" :alt="altText" loading="lazy" />
  14. </picture>
  15. <div class="alt--text">{{ altText }}</div>
  16. </div>
  17. </section>
  18. </template>
  19. <script setup>
  20. // Props 정의
  21. const props = defineProps({
  22. height: {
  23. type: String,
  24. default: "100vh",
  25. },
  26. imagePath: {
  27. type: String,
  28. default: "/img/exclusive/1920X1080_exclusive_edited_v2.jpg",
  29. },
  30. textLocation: {
  31. type: String,
  32. default: "bottom",
  33. validator: (value) => ["bottom", "top", "left", "right"].includes(value),
  34. },
  35. altText: {
  36. type: String,
  37. default: "Banner Image",
  38. },
  39. type: {
  40. type: String,
  41. default: "contain", // 'horz' , 'vert'
  42. validator: (value) => ["contain", "cover"].includes(value),
  43. },
  44. });
  45. </script>