fullSizeBannerText1.vue 1.0 KB

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