内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

Swiper怎么在Vue中使用-創(chuàng)新互聯(lián)

這篇文章給大家介紹Swiper怎么在Vue中使用,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。

目前成都創(chuàng)新互聯(lián)已為1000多家的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)絡(luò)空間、網(wǎng)站運營、企業(yè)網(wǎng)站設(shè)計、橋東網(wǎng)站維護等服務(wù),公司將堅持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。

首先使用npm 或者cnpm下載swiper 

cnpm install swiper

引入swiper

import Swiper from ‘swiper'; 
import ‘swiper/dist/css/swiper.min.css';

使用swiper

<div class="swiper-container">
  <div class="swiper-wrapper">
   <div class="swiper-slide">
    <img src="../../static/images/ad1.jpg" alt="">
   </div>
   <div class="swiper-slide">
    <img src="../../static/images/ad2.jpg" alt="">
   </div>
   <div class="swiper-slide">
    <img src="../../static/images/ad3.jpg" alt="">
   </div>
  </div>
 </div>

mounted里面調(diào)用

  mounted(){
    var mySwiper = new Swiper('.swiper-container', {
     autoplay:true,
     loop:true
    })
   },

注意

如果想要從后臺請求圖片放上去 new Swiper要寫在網(wǎng)絡(luò)請求成功的函數(shù)里面,否則不會出來數(shù)據(jù)。

slider組件的內(nèi)容如下:

<template>
 <swiper :options="swiperOption" ref="mySwiper">
  <!-- slides -->
  <swiper-slide v-for="(picitem,index) in items" :key="index">
   <img :src="picitem.src" alt="">
  </swiper-slide>
 </swiper>
</template>
<script type="text/ecmascript-6">
 import {swiper, swiperSlider} from 'vue-awesome-swiper'

 export default {
  data() {
   return {
    swiperOption: {
     notNextTick: true,
     loop: true,
     autoplay: true,
     speed: 1000,
     direction: 'horizontal',
     grabCursor: true,
     setWrapperSize: true,
     autoHeight: true,
     pagination: '.swiper-pagination',
     paginationClickable: true,
     mousewheelControl: true,
     observeParents: true,
     debugger: true
    },
    items: [
     {src: 'http://localhost/static/images/1.jpg'},
     {src: 'http://localhost/static/images/2.jpg'},
     {src: 'http://localhost/static/images/3.jpg'},
     {src: 'http://localhost/static/images/4.jpg'},
     {src: 'http://localhost/static/images/5.jpg'}
    ],
   }
  },
  components: {
   swiper,
   swiperSlider
  }
 }
</script>
<style lang="stylus" rel="sheetstylus">

</style>

關(guān)于Swiper怎么在Vue中使用就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

本文題目:Swiper怎么在Vue中使用-創(chuàng)新互聯(lián)
新聞來源:http://www.rwnh.cn/article38/cssopp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航網(wǎng)頁設(shè)計公司、云服務(wù)器、外貿(mào)建站、網(wǎng)站設(shè)計定制開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)
盐池县| 黑水县| 莱州市| 贡山| 松桃| 阿尔山市| 洛川县| 丁青县| 碌曲县| 固始县| 兴和县| 车险| 洮南市| 房山区| 石家庄市| 奉节县| 黎平县| 盐城市| 海南省| 承德县| 罗甸县| 江津市| 天镇县| 富锦市| 灯塔市| 出国| 丹东市| 青冈县| 天镇县| 平邑县| 根河市| 平泉县| 双峰县| 兴宁市| 逊克县| 四川省| 上高县| 安庆市| 遂宁市| 都江堰市| 泰顺县|