本文為大家分享了VUE 3D輪播圖封裝的具體代碼,供大家參考,具體內容如下
一、體驗地址

二、實現功能點
(1)、無縫輪播
(2)、進入變大、離開縮小(類3d切換效果)
三、js代碼
<!--輪播圖插件模板--><template></template><script type="text/ecmascript-6"> import {swiper, swiperSlide} from 'vue-awesome-swiper' require('swiper/dist/css/swiper.css');//注意這里 import Pageination from "./pageination" import { mapActions, mapMutations, mapGetters, mapState} from "vuex" import {getPriceSymbolValue} from '../../util/tool/index' export default { //props: ['bannerList'], data() { let _self=this; return { pageinationIndex:0, data: { "bannerList":[] }, swiperOption: { loop: true, // 循環 speed:500, //切換速度 mousewheelControl: false,// 禁止鼠標滾輪切換 lazy: { loadPrevNext: true, }, pagination: { el: '.swiper-pagination', }, autoplay: { delay:2000, stopOnLastSlide: false, // 切換到最后一個時不停止 disableOnInteraction: false, //用戶操作swiper之后 不停止autoplay }, watchSlidesProgress:true, centeredSlides: true, //設定為true時,活動塊會居中,而不是默認狀態下的居左。 spaceBetween:10, slidesPerView: 1.7, loopedSlides :2, observer: true, observeParents: true } } }, methods: { }, mounted() { // 這邊就可以使用swiper這個對象去使用swiper官網中的那些方法// this.$nextTick(function() {// this.swiper.slideTo(3, 10, false);// }); }, computed: { swiper() { return this.$refs.mySwiper.swiper } }, components: { swiper, swiperSlide, Pageination } }</script><style lang="scss" type="text/scss"></style>以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。
新聞熱點
疑難解答