vue swiper的安装使用

githut:https://github.com/surmon-china/vue-awesome-swiper

swiper中文网:https://www.swiper.com.cn/

1 npm 安装

在指定的目录下

npm install vue-awesome-swiper --save

2引用

全局;在main.js中

import Vue from 'vue'
import VueAwesomeSwiper from 'vue-awesome-swiper'

// require styles
import 'swiper/dist/css/swiper.css'

Vue.use(VueAwesomeSwiper, /* { default global options } */)

局部引用

// require styles
import 'swiper/dist/css/swiper.css'

import { swiper, swiperSlide } from 'vue-awesome-swiper'

export default {
  components: {
    swiper,
    swiperSlide
  }
}

 

你可能感兴趣的:(vue.js)