Skip to content

基础使用

注意:hi-swiper-indicator 默认 position: absolute
可以结合 hi-swiper 或用户自定义的 swiper 组合使用。

vue
<hi-swiper :list="list" :autoplay="true">
    <template #indicator="{ current }">
        <hi-swiper-indicator :count="list.length" :current="current"></hi-swiper-indicator>
    </template>
</hi-swiper>

指示器的位置

可以通过 position 参数设置指示器的位置。可选的值有:bottom-center(默认)bottom-leftbottom-rightleft-bottomleft-centerright-cottomright-center

vue
<hi-swiper :list="list" :autoplay="true">
    <template #indicator="{ current }">
        <hi-swiper-indicator :count="list.length" :current="current" position="bottom-right"></hi-swiper-indicator>
    </template>
</hi-swiper>

指示器的类型

可以通过 mode 参数设置指示器的类型。可选的值有:dots(默认)line

vue
<hi-swiper :list="list" :autoplay="true">
    <template #indicator="{ current }">
        <hi-swiper-indicator :count="list.length" :current="current" mode="line"></hi-swiper-indicator>
    </template>
</hi-swiper>

Props

uni-app swiper 官方文档

参数说明类型默认值可选值
count数量Number0-
current激活项的下标Number0-
mode指示器的模式Stringdotsdotsline
position指示器的位置Stringbottom-centerbottom-centerbottom-leftbottom-rightleft-bottomleft-centerright-cottomright-center

Events

uni-app swiper 官方文档

事件名说明回调参数
@click指示器 item 点击时触发index: 被点击的指示器 item 的下标