最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue實現(xiàn)帶縮略圖的輪播圖效果

 更新時間:2024年02月01日 10:01:36   作者:lllomh  
這篇文章主要為大家詳細(xì)介紹了如何使用vue實現(xiàn)帶縮略圖的輪播圖效果,文中的示例代碼講解詳細(xì),具有一定的借鑒價值,有需要的可以參考下

1.引入swiper和vue-awesome-swiper插件

npm install swiper@4 --save
npm install vue-awesome-swiper@3 --save

2.在main.js中引入:

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

3.使用:

template:布局

<template>
  <div>
    <div class="thumb-example">
      <!-- swiper1 -->
      <swiper
              class="swiper gallery-top"
              :options="swiperOptionTop"
              ref="swiperTop"
      >
        <swiper-slide class="slide-1" v-for="item in bigImg" :key="item.id">
          <img :src="item.url" style="height:570px;width:100%" alt="" />
        </swiper-slide>
        <div
                class="swiper-button-next swiper-button-white"
                slot="button-next"
        ></div>
        <div
                class="swiper-button-prev swiper-button-white"
                slot="button-prev"
        ></div>
      </swiper>
      <!-- swiper2 Thumbs -->
      <swiper
              class="swiper gallery-thumbs"
              :options="swiperOptionThumbs"
              ref="swiperThumbs"
      >
        <swiper-slide
                class="slide"
                style="width:100px;height:100px;"
                v-for="item in bigImg"
                :key="item.id"
        >
          <img style="width:100px;height:100px;" :src="item.url" alt="" />
        </swiper-slide>
        <div class="swiper-button-next swiper-button-white" slot="button-next">
          <div>
            <img src="../assets/ArtIcon-offs.svg" alt="" />
          </div>
        </div>
        <div class="swiper-button-prev swiper-button-white" slot="button-prev">
          <div>
            <img src="../assets/ArtIcon-offs.svg" alt="" />
          </div>
        </div>
      </swiper>
    </div>
  </div>
</template>
 
<script>
export default {
  mounted() {
    // 實現(xiàn)swiper雙向控制
    this.$nextTick(() => {
      const swiperTop = this.$refs.swiperTop.swiper
      const swiperThumbs = this.$refs.swiperThumbs.swiper
      swiperTop.controller.control = swiperThumbs
      swiperThumbs.controller.control = swiperTop
    })
  },
  data() {
    return {
      //輪播大圖配置
      bigImg: [
        {
          url: 'https://bhw.lllomh.com/images/02.jpg',
          id: 0
        },
        {
          url: 'https://bhw.lllomh.com/images/01.jpg',
          id: 1
        },
        {
          url: 'https://bhw.lllomh.com/images/03.jpg',
          id: 2
        },
        {
          url: 'https://bhw.lllomh.com/images/04.jpg',
          id: 3
        }
      ],
      swiperOptionTop: {
        zoom: true,
        loop: true,
        loopedSlides: 5, // looped slides should be the same
        spaceBetween: 10,
        observer: true, //修改swiper自己或子元素時,自動初始化swiper
        observeParents: true, //修改swiper的父元素時,自動初始化swiper
        // autoplay: {  //自動輪播
        //   delay: 2000,
        //   disableOnInteraction: false
        // },
        navigation: {
          nextEl: '.swiper-button-next',
          prevEl: '.swiper-button-prev'
        }
      },
      swiperOptionThumbs: {
        loop: true,
        loopedSlides: 5, // looped slides should be the same
        spaceBetween: 10,
        centeredSlides: true,
        slidesPerView: 'auto',
        touchRatio: 0.2,
        slideToClickedSlide: true,
        navigation: {
          nextEl: '.swiper-button-next',
          prevEl: '.swiper-button-prev'
        }
      }
    }
  },
 
  methods: {}
}
</script>

4.scss or sass

<style lang="scss" scoped>
h3 {
  margin: 20px 0 0 10px;
}
.thumb-example {
  width: 864px;
  margin-top: 20px;
  // background: #000;
}
.swiper-slide {
  background-size: cover;
  background-position: center;
}
.gallery-top {
  // height: 80% !important;
  height: 600px;
  width: 100%;
}
.gallery-thumbs {
  height: 20% !important;
  box-sizing: border-box;
  padding: 10px 0px;
  width: 864px;
  margin-left: 2px;
  .swiper-button-next {
    right: 0px;
  }
  .swiper-button-prev {
    left: 0px;
  }
  .swiper-button-next,
  .swiper-button-prev {
    background: #fff;
    width: 45px;
    text-align: center;
    height: 101px;
    top: 26%;
    div {
      margin-top: 30px;
      background: rgb(207, 205, 205);
      height: 45px;
      border-radius: 50%;
      img {
        margin: 7px 0 0 2px;
        width: 30px;
      }
    }
  }
  .swiper-button-next:hover div {
    background: rgb(189, 186, 186);
  }
  .swiper-button-prev:hover div {
    background: rgb(189, 186, 186);
  }
}
.gallery-thumbs .swiper-slide {
  width: 20%;
  height: 80px;
  // opacity: 0.4;
}
.gallery-thumbs .swiper-slide-active {
  border: 2px solid red;
}
</style>

這樣就可以了

效果:

到此這篇關(guān)于vue實現(xiàn)帶縮略圖的輪播圖效果的文章就介紹到這了,更多相關(guān)vue帶縮略圖輪播內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 導(dǎo)致VUE頁面不刷新的問題分析及解決方法

    導(dǎo)致VUE頁面不刷新的問題分析及解決方法

    由于 Vue 會在初始化實例時對 property 執(zhí)行 getter/setter 轉(zhuǎn)化,所以 property 必須在 data 對象上存在才能讓 Vue 將它轉(zhuǎn)換為響應(yīng)式的,這篇文章主要介紹了導(dǎo)致VUE頁面不刷新的問題分析及解決方法,需要的朋友可以參考下
    2024-04-04
  • vue中data數(shù)據(jù)之間如何賦值問題

    vue中data數(shù)據(jù)之間如何賦值問題

    這篇文章主要介紹了vue中data數(shù)據(jù)之間如何賦值問題,具有很好的參考價值,希望對大家有所幫助。
    2022-09-09
  • Vue實現(xiàn)表格批量審核功能實例代碼

    Vue實現(xiàn)表格批量審核功能實例代碼

    這篇文章主要為大家詳細(xì)介紹了Vue實現(xiàn)表格批量審核功能實例代碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-05-05
  • vue.js過濾器+ajax實現(xiàn)事件監(jiān)聽及后臺php數(shù)據(jù)交互實例

    vue.js過濾器+ajax實現(xiàn)事件監(jiān)聽及后臺php數(shù)據(jù)交互實例

    這篇文章主要介紹了vue.js過濾器+ajax實現(xiàn)事件監(jiān)聽及后臺php數(shù)據(jù)交互,結(jié)合實例形式分析了vue.js前臺過濾器與ajax后臺數(shù)據(jù)交互相關(guān)操作技巧,需要的朋友可以參考下
    2018-05-05
  • Vue分頁組件的封裝方法

    Vue分頁組件的封裝方法

    這篇文章主要為大家詳細(xì)介紹了Vue分頁組件的封裝方法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-07-07
  • 關(guān)于el-table-column的formatter的使用及說明

    關(guān)于el-table-column的formatter的使用及說明

    這篇文章主要介紹了關(guān)于el-table-column的formatter的使用及說明,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-10-10
  • Vue開發(fā)環(huán)境中修改端口號的實現(xiàn)方法

    Vue開發(fā)環(huán)境中修改端口號的實現(xiàn)方法

    這篇文章主要介紹了Vue開發(fā)環(huán)境中修改端口號的實現(xiàn)方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-08-08
  • Vue3中Composition API的原理與實戰(zhàn)指南

    Vue3中Composition API的原理與實戰(zhàn)指南

    Composition API為開發(fā)者提供了一種全新的組織組件邏輯的方式,本文將深入探討Vue3中Composition API的實際應(yīng)用,幫助開發(fā)者掌握這一強大工具
    2025-07-07
  • 解決Vue打包上線之后部分CSS不生效的問題

    解決Vue打包上線之后部分CSS不生效的問題

    今天小編就為大家分享一篇解決Vue打包上線之后部分CSS不生效的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-11-11
  • vue3如何實現(xiàn)單點登錄

    vue3如何實現(xiàn)單點登錄

    這篇文章主要介紹了vue3如何實現(xiàn)單點登錄問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-03-03

最新評論

武冈市| 临安市| 塘沽区| 宝坻区| 宝应县| 库尔勒市| 和平区| 虹口区| 汝城县| 云安县| 理塘县| 阿鲁科尔沁旗| 长岛县| 额尔古纳市| 阳春市| 淅川县| 荣成市| 台江县| 南雄市| 莱芜市| 乐至县| 手机| 永修县| 思南县| 垣曲县| 莲花县| 盐亭县| 长治市| 营口市| 虎林市| 图木舒克市| 资中县| 陆丰市| 固镇县| 怀来县| 凤山县| 图木舒克市| 石棉县| 青河县| 万全县| 灵宝市|