Yt-UI
首页
快速开始
组件文档
首页
快速开始
组件文档
  • 表单组件

    • 输入框 Input
    • 多行输入框 Textarea
    • 开关 Switch
    • 多选框组 CheckboxGroup
    • 单选框组 RadioGroup
    • 滑块 Slider
    • 选择器 Picker
    • 日历 Calendar
    • 表单 Form
  • 展示组件

    • 头像 Avatar
    • 徽标 Badge
    • 卡片 Card
    • 标签 Tag
    • 步骤条 Steps
    • 结果页 Result
    • 空状态 Empty
    • 虚拟列表 VirtualList
  • 交互组件

    • 按钮 Button
    • 悬浮按钮 FAB
    • 图标 Icon
    • 搜索 Search
    • 分段器 Segment
    • 轮播 Swiper
    • 指示点 Dots
  • 反馈组件

    • 加载 Loading
    • 弹窗 Popup
    • 遮罩层 Overlay
    • 通告栏 NoticeBar
  • 导航组件

    • 标签栏 Tabbar
    • 顶部标签栏 TopTabbar
    • 折叠面板 Collapse
    • 课程表 Schedule
  • 布局组件

    • 分割线 Divider
    • 链接 Line
    • 可移动视图 MovableView

yt-swiper 轮播组件

属性

属性名类型默认值说明
themeThemeColor | 'none''none'主题颜色
disabledbooleanfalse是否禁用
showBgColorbooleanfalse是否显示背景色
listany[][]轮播数据列表
modelValuenumber | nullnull当前索引 (v-model)
widthnumber | string'100%'轮播宽度
heightnumber | string'100%'轮播高度
direction'horizontal' | 'vertical''horizontal'轮播方向
durationnumber500动画时长
showArrowbooleanfalse是否显示箭头
arrowColor'light' | 'dark''light'箭头颜色
arrowSizenumber16箭头大小
showDotsbooleanfalse是否显示指示点
dotsSizenumber32指示点大小
maxDotsnumber7最大指示点数
dotsSide'left' | 'right''right'垂直时指示点位置
dotsOffsetnumber | string'15%'指示点偏移
loopbooleantrue是否循环轮播
autoplaybooleanfalse是否自动播放
intervalnumber2000自动播放间隔
type'default' | 'card''default'轮播类型
activeCardScalenumber0.8卡片激活缩放
inactiveCardScalenumber0.6卡片非激活缩放
cardGapnumber25卡片间距
borderRadiusnumber | string0圆角大小

主题颜色

<yt-swiper theme="forest" :list="list" />

<yt-swiper theme="ocean" :list="list" />

<yt-swiper theme="magic" :list="list" />

<yt-swiper theme="blossom" :list="list" />

<yt-swiper theme="sunshine" :list="list" />

<yt-swiper theme="classic" :list="list" />

<yt-swiper theme="forest-sky" :list="list" />

<yt-swiper theme="ocean-sky" :list="list" />

<yt-swiper theme="magic-sky" :list="list" />

<yt-swiper theme="blossom-sky" :list="list" />

<yt-swiper theme="sunshine-sky" :list="list" />

插槽

插槽名作用域参数说明
swiper-item{ item: any, index: number }轮播项内容

事件

事件名参数说明
update:modelValuemodelValue: numberv-model 更新
click(e: Event, index: number)点击轮播项
changeindex: number轮播切换

示例

基本轮播

<yt-swiper :list="list">
  <template v-slot:swiper-item="{ item }">
    <image :src="item.image" mode="aspectFill" />
  </template>
</yt-swiper>

水平轮播

<yt-swiper :list="list" direction="horizontal">
  <!-- 内容 -->
</yt-swiper>

垂直轮播

<yt-swiper :list="list" direction="vertical">
  <!-- 内容 -->
</yt-swiper>

显示箭头

<yt-swiper :list="list" :showArrow="true" />

浅色箭头

<yt-swiper :list="list" :showArrow="true" arrowColor="light" />

深色箭头

<yt-swiper :list="list" :showArrow="true" arrowColor="dark" />

显示指示点

<yt-swiper :list="list" :showDots="true" />

自动播放

<yt-swiper :list="list" :autoplay="true" :interval="3000" />

卡片轮播

<yt-swiper :list="list" type="card" :activeCardScale="0.9" :inactiveCardScale="0.7" />

非循环轮播

<yt-swiper :list="list" :loop="false" />

自定义尺寸

<yt-swiper :list="list" :width="300" :height="200" />

事件处理

<yt-swiper
  :list="list"
  v-model="currentIndex"
  @click="handleSwiperClick"
  @change="handleSwiperChange"
/>

完整示例

<yt-swiper
  theme="forest-sky"
  :list="bannerList"
  v-model="currentBanner"
  :autoplay="true"
  :interval="3000"
  :loop="true"
  :showArrow="true"
  :showDots="true"
  :dotsSize="24"
  :arrowColor="light"
  :type="default"
  :duration="500"
  @click="handleBannerClick"
  @change="handleBannerChange"
>
  <template v-slot:swiper-item="{ item, index }">
    <image :src="item.image" class="banner-image" mode="aspectFill" />
    <view class="banner-title">{{ item.title }}</view>
  </template>
</yt-swiper>
最近更新:: 2026/3/9 19:16
Contributors: CHEEMS, 2126340634
Prev
分段器 Segment
Next
指示点 Dots