Carousel 캐러셀
가로 캐러셀: 네이티브 swiper 랩핑 형태(제스처를 직접 작성하지 않음), 자동 재생, 루프 순환, dots 인디케이터(bottom 문서 흐름 / overlay 겹침) 자체 렌더링. 페이지 순서 수학은 전부 @lh-ui/share/core/carousel을 소비합니다.
플랫폼 차이(등록): 미니프로그램 런타임은 슬롯 자식 노드 목록을 가져올 수 없으므로, 페이지 콘텐츠는 항상 items 데이터 주도 + item 스코프 슬롯을 사용합니다(web 三端의 "기본 슬롯 다중 자식" 형태는 여기에 적용되지 않음).
showArrow는 web 데스크톱 형태이며 이 단에서는 렌더링하지 않습니다.
기본 사용법
vue
<template>
<lh-carousel :items="banners" :height="140">
<template #item="{ index, item }">
<view class="page">{{ item }}({{ index + 1 }})</view>
</template>
</lh-carousel>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const banners = ['수묵', '단청', '공필']
</script>자동 재생과 비루프
vue
<template>
<lh-carousel :items="banners" :height="140" :autoplay="3000" :loop="false">
<template #item="{ item }">
<view class="page">{{ item }}</view>
</template>
</lh-carousel>
</template>제어형 v-model
vue
<template>
<lh-carousel v-model="page" :items="banners" :height="140">
<template #item="{ item }">
<view class="page">{{ item }}</view>
</template>
</lh-carousel>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const page = ref(0)
</script>Props
| 속성 | 설명 | 타입 | 기본값 |
|---|---|---|---|
| v-model / modelValue | 현재 페이지 번호(제어형. 미지정 시 비제어) | number | — |
| items | 페이지 데이터 소스(항목당 한 페이지, item 슬롯과 함께) | unknown[] | — |
| autoplay | 자동 재생 간격 ms(0 / 미지정 = 비활성) | number | 0 |
| loop | 루프 순환(swiper의 circular에 매핑) | boolean | true |
| indicator | 인디케이터 형태 | "dots" | "none" | 'dots' |
| indicatorPosition | 인디케이터 위치 | "bottom" | "overlay" | 'bottom' |
| height | 높이 px | number | 200 |
| showArrow | web 데스크톱 화살표(이 단에서는 렌더링하지 않음) | boolean | false |
| disabled | 비활성(회색 처리 및 자동 재생 중지) | boolean | false |
| ariaLabel | 접근성 이름(미지정 시 페이지 번호 안내) | string | — |
| customClass | 사용자 정의 클래스(루트 노드) | string | — |
| sx | sx 간편 레이아웃 속성 | — | — |
Events
| 이벤트 | 설명 | 콜백 인자 |
|---|---|---|
| update:modelValue | 제어형 페이지 쓰기 되돌림 | (value: number) |
| change | 페이지 전환(autoplay / 터치 / 프로그래밍 current 통합) | (value: number) |
Slots
| 이름 | 설명 |
|---|---|
| item | 페이지 콘텐츠 스코프 슬롯 { index, item } |
메서드 (ref)
| 메서드 | 설명 |
|---|---|
| prev() / next() | 이전 / 다음 페이지 |
| goTo(index) | 지정 페이지로 이동 |
접근성
- 루트 노드
role="region"+aria-roledescription="carousel", 접근성 이름은ariaLabel또는 페이지 번호 안내. 비현재 페이지는aria-hidden

