0.0.8 • Published 3 months ago

vue-directional-carousel v0.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

vue-directional-carousel

This is a Vue 3 component that allows you to set the direction of image movement not only vertically and horizontally but also in different directions (left, right, up, down).

Installation

You can install the vue-directional-carousel package via npm or yarn:

npm install vue-directional-carousel

or

yarn install vue-directional-carousel

Usage

  • Import the VueDirectionalCarousel component in your Vue.js project:
import DirectionalCarousel from 'vue-directional-carousel'
  • Register the VueDirectionalCarousel component locally in your component:
// if use options api
export default {
  components: {
    DirectionalCarousel
  }
}
  • Use the vue-directional-carousel component in your template:
<template>
  <div>
    <directional-carousel
      :items="imageList"
      :show-prev="true"
      :show-next="true"
      :interval="2000"
      direction="down"
      width="100%"
      height="200px"
    />
  </div>
</template>
<script setup>
  import DirectionalCarousel from 'vue-directional-carousel'

  // Define your carousel image here
  const imageList = [
     'src/assets/sample1.png',
     'src/assets/sample2.png',
     'src/assets/sample3.png',
     'src/assets/sample4.png',
     'src/assets/sample5.png',
     ...
  ]
</script>

Props

propstypeisRequireddefaultdescription
itemsstring[] | { src: string}[]RequiredList of images to be used in the carousel.
widthstringOptional'100%'Width of the carousel.
heightstringOptional'300px'Height of the carousel.
direction'left' | 'right' | 'up' | 'down'Optional'right'Direction in which the images flow.
durationnumberOptional1000Duration of each slide (shorter values make it faster).
intervalnumberOptional0Auto slide interval for images (in ms). Set to 0 to disable auto sliding.
pauseAutoplayOnHoverbooleanOptionalfalseWhen auto slide is enabled, pause the slide when the mouse is over an image. Resume auto slide when the mouse is moved outside the carousel area.
showPrevbooleanOptionaltrueShow previous button.
showNextbooleanOptionaltrueShow next button.
showDotsbooleanOptionaltrueShow buttons indicating the current image sequence. Click to slide to the corresponding image.

Events

추후 기능 추가 예정

Slots

item

Use Slot 'item' in your component:

const items = ref([
  {
    title: "제목1",
    url: "google.com",
  }, {
    title: "제목2",
    url: "ahnlab.com",
  },
]);

<DirectionalCarousel
    :items="items"
    direction="down"
    height="50px"
    width="400px"
    :show-next="true"
    :show-prev="true"
    :interval="2000"
    :pause-autoplay-on-hover="true"
  >
    <template #item="item">
      <div :style="{ backgroundColor: 'white', color: 'black', height: '100%', width: '100%' }">
        {{ item.title }} / {{ item.url }}
      </div>
    </template>
  </DirectionalCarousel>

Contributing

License

MIT

0.0.8

3 months ago

0.0.7

4 months ago

0.0.6

4 months ago

0.0.5

4 months ago

0.0.4

4 months ago

0.0.3

4 months ago

0.0.2

4 months ago

0.0.1

4 months ago