# vue-awesome-swiper **Repository Path**: mayun-gao/vue-awesome-swiper ## Basic Information - **Project Name**: vue-awesome-swiper - **Description**: 🏆 Swiper component for @vuejs - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-08-11 - **Last Updated**: 2022-01-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
# vue-awesome-swiper  [](https://github.com/surmon-china/vue-awesome-swiper/stargazers) [](https://www.npmjs.com/package/vue-awesome-swiper) [](https://github.com/surmon-china/vue-awesome-swiper/actions?query=workflow%3APublish) [](https://github.com/surmon-china/vue-awesome-swiper/issues) [](https://github.com/surmon-china/vue-awesome-swiper/blob/master/LICENSE) [](https://www.npmjs.com/package/vue-awesome-swiper) **[Swiper](https://swiperjs.com)** component for Vue. Old versions: - Swiper 4: [v3.1.3](https://github.com/surmon-china/vue-awesome-swiper/tree/v3.1.3) - Swiper 3: [v2.6.7](https://github.com/surmon-china/vue-awesome-swiper/tree/v2.6.7) ### Example - [Online examples](https://github.surmon.me/vue-awesome-swiper) - [CDN example](https://jsfiddle.net/surmon/kLtj6h3p/) - [SSR example code](https://github.com/surmon-china/surmon-china.github.io/tree/source/projects/vue-awesome-swiper/nuxt) - [TypeScript & composition-api example code](https://github.com/surmon-china/surmon-china.github.io/blob/source/projects/vue-awesome-swiper/examples/00-typescript-composition-api.vue) --- ### Install ``` bash npm install swiper vue-awesome-swiper --save # or yarn add swiper vue-awesome-swiper # Swiper5 is recommended yarn add swiper@5.x vue-awesome-swiper ``` ### Global Registration ``` javascript import Vue from 'vue' import VueAwesomeSwiper from 'vue-awesome-swiper' // import style (>= Swiper 6.x) import 'swiper/swiper-bundle.css' // import style (<= Swiper 5.x) import 'swiper/css/swiper.css' Vue.use(VueAwesomeSwiper, /* { default options with global component } */) ``` ### Local Registration ```javascript import { Swiper, SwiperSlide, directive } from 'vue-awesome-swiper' // import style (>= Swiper 6.x) import 'swiper/swiper-bundle.css' // import style (<= Swiper 5.x) import 'swiper/css/swiper.css' export default { components: { Swiper, SwiperSlide }, directives: { swiper: directive } } ``` ### CDN ``` html ``` --- ### Difference with usage **Directive and the only difference in the use of the Component:** - `component` find Swiper instance by [`ref attribute`](https://vuejs.org/v2/guide/components-edge-cases.html#Accessing-Child-Component-Instances-amp-Child-Elements). - `directive` find Swiper instance by [`directive arg`](https://vuejs.org/v2/guide/custom-directive.html#Dynamic-Directive-Arguments). Other configurations, events are the same. The effect of the two ways and the difference in the applicable environment [is here](https://github.com/surmon-china/surmon-china.github.io/blob/source/projects/vue-awesome-swiper/nuxt/). ### Component ```html