New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

swiper-vue

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swiper-vue

轮播 swiper slider component for Vue.js

  • 0.0.12
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
10
Maintainers
1
Weekly downloads
 
Created
Source

swiper-vue,swiper

description

基于vue3.0的轮播组件,有左右和上下轮播方向。

支持左右点击箭头切换,也可以点击下方指示器切换。

支持鼠标左键点击item项后滑动切换,支持鼠标滚动切换。

具体配置、事件、插槽可看下方详细文档

在vue单组件内部引入

<template>
    <swiper-vue autoplay :delay='2000' arrow='hover' indicator :items="options">
        <template #default="{ item, index,activeIndex,isActive }">
            <div style="height: 100%;width: 100%;background: #99A9BF;display: flex;justify-content: center;align-items: center;">{{ item.name }}</div>
        </template>
    </swiper-vue>
</template>
<script lang='ts' setup>
    import 'swiper-vue/dist/hut-es.css';
    import { SwiperVue } from 'swiper-vue';

    const options = [
        {
            name: 'swiper1'
        },
        {
            name: 'swiper2'
        },
        {
            name: 'swiper3'
        }
    ]
</script>

全局引入

    import { createApp } from 'vue'
    import 'swiper-vue/dist/hut-es.css';
    import SwiperVue from 'swiper-vue';

    const $app = createApp(App);
    $app.use(SwiperVue);
    $app.mount('#app');`

Properties

propertytypedefaultdescription
itemsArray数据源轮播数据源,数组形式
directionStringhorizontal当前轮播的方向,默认为horizontal水平,vertical为垂直
autoplayBooleantrue是否自动播放轮播
delayNumber2000自动播放间隔,单位毫秒,默认2秒
indicatorBooleantrue是否显示轮播底部指示器
mouseSliderBooleantrue是否开启鼠标点击轮播项左右滑动切换
triggerMoveNumbernull鼠标点击轮播项左右滑动切换的触发值,默认为滑动该容器1/2.5宽度或者高度切换
mouseScrollBooleanfalse是否开启鼠标滚轮切换轮播,默认不开启
hoverStopBooleantrue鼠标悬停时暂停轮播,默认为true
arrowStringalways左右切换箭头的显示形式,默认一直显示,值为always、hover、none
heightNumber200轮播容器高度
widthNumbernull轮播容器宽度,默认为容器父元素宽度

swiper Event

namedescription
on-change轮播切换后触发事件,function(type:'pre'

Swiper Slot

namedescription
default轮播项内容,item为当前项值,index为当前索引,activeIndex为当前激活项索引,isActive为当前项是否激活
pre-icon轮播左切换
next-icon轮播右切换

Keywords

FAQs

Package last updated on 23 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc