码迷,mamicode.com
首页 > 其他好文 > 详细

Vue使用Swiper

时间:2020-06-15 21:09:30      阅读:447      评论:0      收藏:0      [点我收藏+]

标签:ebe   css   ble   col   view   direct   direction   dir   ted   

1.下载包

npm install vue-awesome-swiper --save

2.main.js引包

import VueAwesomeSwiper from ‘vue-awesome-swiper‘
Vue.use(VueAwesomeSwiper)
import ‘swiper/dist/css/swiper.css‘

3.组件中使用

 <div class="swiper-container">
             <div class="swiper-wrapper">
                 <div class="swiper-slide">Slide 1</div>
                 <div class="swiper-slide">Slide 2</div>
                 <div class="swiper-slide">Slide 3</div>
                 <div class="swiper-slide">Slide 4</div>
                 <div class="swiper-slide">Slide 5</div>
                 <div class="swiper-slide">Slide 6</div>
                 <div class="swiper-slide">Slide 7</div>
                 <div class="swiper-slide">Slide 8</div>
                 <div class="swiper-slide">Slide 9</div>
                 <div class="swiper-slide">Slide 10</div>
             </div>
             <!-- Add Pagination -->
             <div class="swiper-pagination"></div>
         </div>
//引包
import Swiper from ‘swiper‘
//使用
 mounted(){
        var swiper = new Swiper(‘.swiper-container‘, {
               direction: ‘vertical‘,
               slidesPerView: 1,
               spaceBetween: 30,
               mousewheel: true,
               pagination: {
                 el: ‘.swiper-pagination‘,
                 clickable: true,
               },
           });
    },

 

Vue使用Swiper

标签:ebe   css   ble   col   view   direct   direction   dir   ted   

原文地址:https://www.cnblogs.com/yangjunboHTML/p/13137557.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!