swiper-vue2

Swiper component for Vue 2
112,067 20
Install
npm install swiper-vue2
Latest Version:1.0.10
Vue:2
License:MIT
Last Updated:Jul 11, 2026
Links: GitHub  ·  npm
Maintainer: orest_dev

swiper-vue2

npm npm

Installation

npm i swiper-vue2

Usage

swiper-vue2 exports SwiperCore and 2 Vue components: Swiper, SwiperSlide

<template>
  <div>
    <swiper
      :slides-per-view="3"
      :space-between="30"
      :loop="false"
      @swiper="onSwiper"
      @slideChange="onSlideChange"
    >
      <swiper-slide
        v-for="n in 5"
        :key="n"
        class="test"
        :class="{test_2: true}"
      >
        <div>{{ 29+n }}</div>
        <img
          :src="https://raw.githubusercontent.com/Orest-2/swiper-vue2/HEAD/getImageUrl(29+n)"
          width="600"
          height="400"
          class="img-fluid w-100 mx-auto"
          blank="true"
        >
      </swiper-slide>
    </swiper>

    <swiper
      :slides-per-view="3"
      :space-between="30"
      loop
      @swiper="onSwiper"
      @slideChange="onSlideChange"
    >
      <swiper-slide
        v-for="n in 5"
        :key="n"
        class="test"
        :class="{test_2: true}"
      >
        <div>{{ 34+n }}</div>
        <img
          :src="https://raw.githubusercontent.com/Orest-2/swiper-vue2/HEAD/getImageUrl(34+n)"
          width="600"
          height="400"
          class="img-fluid w-100 mx-auto"
          blank="true"
        >
      </swiper-slide>
    </swiper>

    <h2>pagination - navigation</h2>
    <swiper
      :slides-per-view="3"
      :space-between="30"
      :loop="false"
      :pagination="true"
      :navigation="true"
      @swiper="onSwiper"
      @slideChange="onSlideChange"
    >
      <swiper-slide
        v-for="n in 5"
        :key="n"
        class="test"
        :class="{test_2: true}"
      >
        <div>{{ 34+n }}</div>
        <img
          :src="https://raw.githubusercontent.com/Orest-2/swiper-vue2/HEAD/getImageUrl(34+n)"
          width="600"
          height="400"
          class="img-fluid w-100 mx-auto"
          blank="true"
        >
      </swiper-slide>
    </swiper>
  </div>
</template>

<script>
import { Navigation, Pagination } from 'swiper'

import { SwiperCore, Swiper, SwiperSlide } from 'swiper-vue2'

// Import Swiper styles
import 'swiper/swiper-bundle.css'

SwiperCore.use([Navigation, Pagination])

export default {
  components: {
    Swiper,
    SwiperSlide
  },
  methods: {
    getImageUrl (imageId) {
      return `https://picsum.photos/600/400/?image=${imageId}`
    },
    onSwiper (swiper) {
      console.log(swiper)
    },
    onSlideChange () {
      console.log('slide change')
    }
  }
}
</script>

<style lang="scss" scoped>
.img-fluid {
  max-width: 100%;
  height: auto;
}
.w-100 {
  width: 100%;
}
.ml-auto, .mx-auto {
  margin-left: auto;
}
.mr-auto, .mx-auto {
  margin-right: auto;
}
</style>

Related Packages

@morev/vue-swiper

Latest Swiper with extra features. For Vue 2 + SSR

1,149 3
vue-concise-slider

vue-slider,A simple sliding component,has easy configuration,support self-adapti...

125,004
vue2-swiper

一个简单的vue2.x swiper插件

7,655 12

Version History

Version Released License
1.0.10 MIT
1.0.9 MIT
1.0.8 MIT
1.0.7 MIT
1.0.6 MIT