vue-awsome-swiper稳定版本3.1.3及使用方法,API见swiper官网https://www.swiper.com.cn/api/index.html

1.npm和yarn安装/卸载执行命令

// 安装依赖
npm install
yarn install

// npm安装/移除插件命令
//页面相关引用都要清除

npm install xxx —save 
npm uninastall xxx —save

// yarn安装/移除插件命令
//页面相关引用都要清除

yarn add xxx
yarn remove xxx

2.安装方法:

npm安装

npm install [email protected] --save

 yarn安装

yarn add [email protected]

 3.vue-awsome-swiper引用方式

按照组件形式局部导入:

import { swiper, swiperSlide } from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
export default {
    name: 'Index',
    components: {
        swiper,
        swiperSlide
    },
     data(){
         return{
            }
           }
}

或者全局导入(大家不推荐,我也不推荐):

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

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

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

案列:







 

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