# Image 이미지

미리보기가 가능한 이미지 컨테이너입니다. fit은 네이티브 object-fit을 전달하고, preview는 클릭 미리보기를 켜며, previewSrcList로 여러 이미지를 넘겨볼 수 있습니다.

이미지
<template>
  <div class="demo-col">
    <div class="demo-row" style="gap: 24px; flex-wrap: wrap; align-items: flex-start">
      <div class="demo-col" style="gap: 8px">
        <LhImage :src="src" alt="계산행려도" fit="cover" preview />
        <span class="demo-note">cover + 미리보기 가능</span>
      </div>
      <div class="demo-col" style="gap: 8px">
        <LhImage :src="src" alt="contain 모드" fit="contain" />
        <span class="demo-note">contain</span>
      </div>
      <div class="demo-col" style="gap: 8px">
        <LhImage :src="src" alt="지연 로딩" fit="fill" lazy />
        <span class="demo-note">fill + lazy</span>
      </div>
    </div>
    <p class="demo-note">previewSrcList 다중 이미지 미리보기 (첫 이미지를 클릭해 순서대로 넘겨보기)</p>
    <LhImage :src="src" alt="다중 미리보기 진입점" fit="cover" preview :preview-src-list="gallery" />
  </div>
</template>

<script>
export default {
  data: () => ({
    src: 'data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20width=%27240%27%20height=%27160%27%3E%3Crect%20width=%27240%27%20height=%27160%27%20fill=%27%23e8e2d5%27/%3E%3Cpath%20d=%27M0%20115%20Q60%2080%20120%20115%20T240%20115%20V160%20H0%20Z%27%20fill=%27%23c9c2b2%27/%3E%3Ctext%20x=%2750%%27%20y=%2767%27%20font-size=%2718%27%20fill=%27%232b4c7c%27%20text-anchor=%27middle%27%20font-family=%27serif%27%3E%E6%BA%AA%E5%B1%B1%E8%A1%8C%E6%97%85%E5%9B%BE%3C/text%3E%3C/svg%3E',
    gallery: [
      'data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20width=%27640%27%20height=%27420%27%3E%3Crect%20width=%27640%27%20height=%27420%27%20fill=%27%23e8e2d5%27/%3E%3Cpath%20d=%27M0%20302%20Q160%20210%20320%20302%20T640%20302%20V420%20H0%20Z%27%20fill=%27%23c9c2b2%27/%3E%3Ctext%20x=%2750%%27%20y=%27176%27%20font-size=%2740%27%20fill=%27%232b4c7c%27%20text-anchor=%27middle%27%20font-family=%27serif%27%3E%E7%AC%AC%E4%B8%80%E5%B9%85%3C/text%3E%3C/svg%3E',
      'data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20width=%27640%27%20height=%27420%27%3E%3Crect%20width=%27640%27%20height=%27420%27%20fill=%27%23e8e2d5%27/%3E%3Cpath%20d=%27M0%20302%20Q160%20210%20320%20302%20T640%20302%20V420%20H0%20Z%27%20fill=%27%23c9c2b2%27/%3E%3Ctext%20x=%2750%%27%20y=%27176%27%20font-size=%2740%27%20fill=%27%232b4c7c%27%20text-anchor=%27middle%27%20font-family=%27serif%27%3E%E7%AC%AC%E4%BA%8C%E5%B9%85%3C/text%3E%3C/svg%3E',
      'data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20width=%27640%27%20height=%27420%27%3E%3Crect%20width=%27640%27%20height=%27420%27%20fill=%27%23e8e2d5%27/%3E%3Cpath%20d=%27M0%20302%20Q160%20210%20320%20302%20T640%20302%20V420%20H0%20Z%27%20fill=%27%23c9c2b2%27/%3E%3Ctext%20x=%2750%%27%20y=%27176%27%20font-size=%2740%27%20fill=%27%232b4c7c%27%20text-anchor=%27middle%27%20font-family=%27serif%27%3E%E7%AC%AC%E4%B8%89%E5%B9%85%3C/text%3E%3C/svg%3E',
    ],
  }),
}
</script>

# Props

프로퍼티 설명 타입 기본값
src 이미지 주소 string —
alt 대체 텍스트 (a11y 강제 제약, TS 레벨에서 필수) string —
fit 자르기 모드 (네이티브 object-fit) 'fill' \| 'contain' \| 'cover' \| 'none' \| 'scale-down' 'cover'
preview 클릭하여 미리보기 가능 여부 boolean false
previewSrcList 미리보기 이미지 목록 (미전달 시 [src]로 대체) string[] —
lazy 네이티브 지연 로딩 (loading="lazy") boolean false
sx sx 레이아웃 단축 속성 — —

# ImageViewer Props

개별적으로 내보내지는 뷰어: images(미리보기 이미지 목록), initialIndex(초기 인덱스, 기본 0).

팁

LhImage의 preview에는 뷰어가 내장되어 있어, 대부분의 상황에서 LhImageViewer를 직접 사용할 필요가 없습니다.

Copyright © 2024-2026 FengMo WenXue