tui-vue-swiper

a vue swiper component dependence on swiper

Usage no npm install needed!

<script type="module">
  import tuiVueSwiper from 'https://cdn.skypack.dev/tui-vue-swiper';
</script>

README

tui-vue-swiper

a vue swiper component dependence on swiper@4

Install

npm i tui-vue-swiper

Usage

import swiper from 'tui-vue-swiper'

Vue.use(swiper)

// or
import swiper from 'tui-vue-swiper'

Vue.component('swiper', swiper.swiper)
Vue.component('swiper-slide', swiper.swiperSlide)

// or load js with script
Vue.use(tuiVueSwiper)
@import 'https://unpkg.com/swiper@4.3.3/dist/css/swiper.min.css'
<template>
  <swiper :height="height" :options="options">
    <swiper-slide>1</swiper-slide>
    <swiper-slide>2</swiper-slide>
    <swiper-slide>3</swiper-slide>
    <swiper-slide>4</swiper-slide>
    <swiper-slide>5</swiper-slide>
    <div slot="pagination" class="swiper-pagination"></div>
    <div slot="next" class="swiper-button-next"></div>
    <div slot="prev" class="swiper-button-prev"></div>
  </swiper>
</template>
<script>
export default {
  data() {
    return {
      height: 300
    }
  },
  computed: {
    options() {
      return {
        pagination: {
          el: '.swiper-pagination',
          clickable: true,
        },
        // Navigation arrows
        navigation: {
          nextEl: '.swiper-button-next',
          prevEl: '.swiper-button-prev',
        },
        loop: true,
      }
    }
  },
}
</script>

Props

Name Desc Type Default
height swiper height string/number -
options swiper options object -

Slots

Name Desc
- swiper-slide
pagination swiper pagination
next swiper next
prev swiper prev

Options

dependence swiper@4

options