3.0.2 • Published 8 months ago

vue-split-carousel v3.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
8 months ago

中文文档

Vue Split Carousel

GitHub npm.io

A carousel component for vue, meanwhile display several carousel item.
Support Vue3, Vue2.7, Vue2, Nuxt2, Nuxt3 , Script tag import, support Typescript.

example

Playground

Demo

See the demo in the examples directory | Vue3 | Vue2.7 | Vue2 | Nuxt2 | Nuxt3 | scripts tag import | | ----------------------------------- | ------------------------------------- | ----------------------------------- | ---------------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | Demo | Demo | Demo | Demo | Demo | Vue3 Demo Vue2.7 Demo Vue2 Demo |

Install

# npm
npm i vue-split-carousel
# yarn 
yarn add vue-split-carousel
# pnpm 
pnpm add vue-split-carousel

Package path depends on the environment, the default is the Vue3 version, the package path for different environments:
Vue2 need install @vue/composition-api

  • Vue3: vue-split-carousel
  • Vue2.7: vue-split-carousel/vue2.7
  • Vue2: vue-split-carousel/vue2
  • Nuxt2: vue-split-carousel/dist/vue2.7
  • Nuxt3: vue-split-carousel
  • script import: script address is index.umd.js file under the corresponding Vue version directory under the dist directory

Usage

<split-carousel-item> is used in <split-carousel>, and custom content is placed inside split-carousel-item.

<split-carousel>
  <split-carousel-item>
    custom content
  </split-carousel-item>
  <split-carousel-item>
    custom content2
  </split-carousel-item>
</split-carousel>

Local Component

<template>
  <div id="app">
    <split-carousel>
      <split-carousel-item v-for="item in 8" :key="item">
        {{ item }}
      </split-carousel-item>
    </split-carousel>
  </div>
</template>

<script>
  // Vue3 && Nuxt3
  import { SplitCarousel, SplitCarouselItem } from "vue-split-carousel"; 
  // Vue2.7
  // import { SplitCarousel, SplitCarouselItem } from "vue-split-carousel/vue2.7"; 
  // Vue2
  // import { SplitCarousel, SplitCarouselItem } from "vue-split-carousel/vue2"; 
  // Nuxt2
  // import { SplitCarousel, SplitCarouselItem } from "vue-split-carousel/dist/vue2.7"; 
  export default {
    components: {
      SplitCarousel,
      SplitCarouselItem
    }
  };
</script>

Global Component

import Vue from 'vue'
import SplitCarousel from 'vue-split-carousel'
import App from './App.vue'

const app = createApp(App)
app.use(SplitCarousel) // Vue.use(SplitCarousel) in Vue2
app.mount('#app')

Script tag imports

access through window.VueSplitCarousel variable, script address is index.umd.js file under the corresponding Vue version directory under the dist directory.
Or use public npm package cdn:

<!-- vue3 -->
<script src="https://unpkg.com/vue-split-carousel@3.0.1/dist/vue3/index.umd.js"></script>
<!-- vue2.7 -->
<script src="https://unpkg.com/vue-split-carousel@3.0.1/dist/vue2.7/index.umd.js"></script>
<!-- vue2 -->
<script src="https://unpkg.com/vue-split-carousel@3.0.1/dist/vue2/index.umd.js"></script>
<div id="app"></div>
<script src="https://unpkg.com/vue@3"></script>
<script src="./index.umd.js"></script>
<script>
  const app = Vue.createApp({
    template:`
      <split-carousel>
        <split-carousel-item v-for="i in 8">{{i}}</split-carousel-item>
      </split-carousel>
    `
  })
  app.use(window.VueSplitCarousel)
  app.mount('#app')
</script>

Props

AttributeDescriptionTypeAccepted valueDefault
speedtransition duration of carousel item, in millisecondsNumber-500
autoplaywhether automatically switch carousel itemsBoolean-true
intervalinterval of switch carousel items, in millisecondsNumber-3000
loopwhether display carousel items in loopBoolean-true
display-amountthe amount of carousel items display in carousel containerNumber-4
item-widththe width of carousel itemsNumber-120
heightheight of carousel, if the prop value type is number,the unit is px by default. you can pass string value to use other unit, eg: 40vhNumber/String-80
timing-functionthe animation effect of carousel item,reference transition-timing-functionString-ease
pause-on-hoverwhether pause autoplay while mouse hoverBoolean-true
arrow-visiblewhether arrow visible, available when loop set to falseStringdefault/alwaysdefault

Slots

NameDescription
leftcustomize left arrow
rightcustomize right arrow

License

MIT

3.0.2

8 months ago

3.0.1

1 year ago

3.0.0

1 year ago

1.1.1

2 years ago

2.2.3

2 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.0.5

3 years ago

2.1.0

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago