[](https://juejin.im/entry/57f6a5e7d2030900689c1e9c/detail)
[](https://github.com/surmon-china/vue-awesome-swiper/issues)
[](https://github.com/surmon-china/vue-awesome-swiper/network)
[](https://github.com/surmon-china/vue-awesome-swiper/stargazers)
[](https://twitter.com/intent/tweet?url=https://github.com/surmon-china/vue-awesome-swiper)
[](https://nodei.co/npm/vue-awesome-swiper/)
[](https://nodei.co/npm/vue-awesome-swiper/)
# Vue-Awesome-Swiper
Swiper([Swiper3](http://www.swiper.com.cn)) component for Vue, support pc and mobile, SPA and SSR.
# Example
[Demo Page](https://surmon-china.github.io/vue-awesome-swiper)
# Use Setup for Browser
### Require script and style
``` html
```
### Use
``` javascript
Vue.use(window.VueAwesomeSwiper)
// vue app code...
```
# Use Setup for Webpack
### Install vue-awesome-swiper
``` bash
npm install vue-awesome-swiper --save
```
### Vue mount
``` javascript
// starting with version 2.6.0, you need to manually introduce swiper's css
require('swiper/dist/css/swiper.css')
// import
import Vue from 'vue'
import VueAwesomeSwiper from 'vue-awesome-swiper'
// or require
var Vue = require('vue')
var VueAwesomeSwiper = require('vue-awesome-swiper')
// mount with global
Vue.use(VueAwesomeSwiper)
// If used in Nuxt.js/SSR, you should keep it only in browser build environment
if (process.browser) {
const VueAwesomeSwiper = require('vue-awesome-swiper/ssr')
Vue.use(VueAwesomeSwiper)
}
// mount with component(can't work in Nuxt.js/SSR)
import { swiper, swiperSlide } from 'vue-awesome-swiper'
export default {
components: {
swiper,
swiperSlide
}
}
```
### Use the difference(使用方法的区别)
**SSR and the only difference in the use of the SPA:**
- SPA worked by the `component`, find swiper instance by `ref attribute`.
- SSR worked by the `directive`, find swiper instance by `directive arg`.
- Other configurations, events are the same.
### Use in SSR
``` vue
```
### Use in SPA
``` vue
I'm Slide 1I'm Slide 2I'm Slide 3I'm Slide 4I'm Slide 5I'm Slide 6I'm Slide 7
```
### Async data example
``` vue
I'm Slide {{ slide }}
```
# Mobile Example Code
[mobile-fullpage-example-code](https://github.com/surmon-china/vue-awesome-swiper/blob/master/examples/41-mobile-fullpage-example.vue)
# Nuxt.js/SSR Example Code
[nuxt.js/ssr-example-code](https://github.com/surmon-china/vue-awesome-swiper/blob/master/nuxt-ssr-example)
# Issues
针对中文用户:如果你有未解决的问题请一定要在已关闭的 issues 里进行搜索,绝大多数问题能够得到答案;提问题之前一定要自行测试问题节点,测试出问题所在,若为自身业务问题或基础知识问题或 swiper 本身的问题,问题会被直接关闭。
# API
Swiper's API and configuration can be used.(Swiper官网中的API及配置均可使用)
- [cn Swiper3 apis](http://www.swiper.com.cn/api/index.html)
- [en Swiper3 apis](http://idangero.us/swiper/api/#.WMlhYxJ97mI)
# Author Blog
[Surmon](https://surmon.me)