Skip to content

SeeSwiper

A carousel component supporting image slides, autoplay, multiple indicator styles, and custom content slots.

Basic Usage

vue
<template>
  <SeeSwiper :list="list" @onClick="onItemClick" />
</template>

<script setup>
import SeeSwiper from '@/uni_modules/see-u-ui/components/see-swiper/see-swiper.vue'

const list = [
  { image: 'https://example.com/img1.png', title: 'Title One' },
  { image: 'https://example.com/img2.png', title: 'Title Two' },
  { image: 'https://example.com/img3.png', title: 'Title Three' },
]

const onItemClick = (item, index) => {
  console.log('Clicked:', item.title, index)
}
</script>

Custom Height

Set the carousel height via the height prop. Default is 300rpx.

vue
<SeeSwiper :list="list" height="400rpx" />

Digital Indicator

Use indicatorType="digital" to display a digital page indicator.

vue
<SeeSwiper :list="list" indicatorType="digital" />

No Indicator

Use indicatorType="none" to hide the indicator.

vue
<SeeSwiper :list="list" indicatorType="none" />

Custom Content Slot

Use the item slot to customize carousel content.

vue
<SeeSwiper :list="list" height="400rpx">
  <template #item="{ item, index }">
    <view class="custom-slide">
      <image :src="item.image" mode="aspectFill" />
      <view class="overlay">
        <text>{{ item.title }} - Page {{ index + 1 }}</text>
      </view>
    </view>
  </template>
</SeeSwiper>

v-model Binding

Use v-model:current for two-way binding of the current page index.

vue
<template>
  <SeeSwiper :list="list" v-model:current="current" />
  <button @click="current = 0">Go to first</button>
</template>

<script setup>
import { ref } from 'vue'
const current = ref(0)
</script>

Props

PropDescriptionTypeDefault
listCarousel dataSwiperItemData[][]
heightCarousel heightstring'300rpx'
autoplayEnable autoplaybooleantrue
intervalAutoplay interval in msnumber3000
durationSlide animation duration in msnumber300
loopEnable infinite loopbooleantrue
indicatorTypeIndicator style'dots' | 'digital' | 'none''dots'
activeColorActive indicator colorstring'var(--see-primary)'
inactiveColorInactive indicator colorstring'rgba(255,255,255,0.5)'
currentCurrent page index (v-model)number0

Events

EventDescriptionParameters
onChangeTriggered on slide change(index: number)
onClickTriggered when an item is clicked(item: SwiperItemData, index: number)
update:currentTriggered when page index changes(index: number)

Slots

SlotDescriptionSlot Props
itemCustom carousel item content{ item: SwiperItemData, index: number }

SwiperItemData Type

typescript
interface SwiperItemData {
  /** Image URL */
  image?: string
  /** Title */
  title?: string
  /** Link URL */
  url?: string
  /** Custom data */
  [key: string]: any
}

Liao ICP No. 2025070134