当前位置:网站首页>swiper组件封装
swiper组件封装
2022-04-23 05:56:00 【画不完的饼】
swiper组件
<!--组件调用-->
<ui-swipe :product-image="swiperList" :img-event="showImageViewer" key-name="imageUrl"></ui-swipe>
<!--组件内容-->
<template>
<div class="swipe" @click="imgEvent" style="visibility: 'visible' !important">
<div class="swipe-wrap">
<div class="swiper-container">
<div class="swiper-wrapper">
<figure class="swiper-slide" v-for="(pic, picIndex) in productImage" :key="picIndex" >
<template v-if="pic.linkUrl">
<a :href="pic.linkUrl || 'javascript:void(0)'">
<img
class="h100per"
alt="pic"
:src="pic[keyName]?pic[keyName]:defaultPic"
style="visibility: 'visible' !important"
/>
</a>
</template>
<template v-if="!pic.linkUrl">
<img
class="h100per"
alt="pic"
:src="pic[keyName]?pic[keyName]:defaultPic"
style="visibility: 'visible' !important"
/>
</template>
</figure>
</div>
<div class="swiper-pagination swiper-pagination-red"></div>
</div>
</div>
<slot></slot>
</div>
</template>
<script>
export default {
props: ['productImage', 'imgEvent', 'keyName', 'defaultPic'],
mounted() {
var that = this
Vue.nextTick(function() {
setTimeout(() => {
// eslint-disable-next-line no-undef
new Swiper('.swiper-container', {
autoplay: {
// 自动播放
delay: 3000, // 3s
stopOnLast: false, // 最后一帧自动播放
disableOnInteraction: false // 手动滑动后也能正常播放
},
loop: that.productImage.length > 1, // 回滚
pagination: {
// 配置小点
el: '.swiper-pagination',
clickable: true
}
})
}, 200)
})
},
methods: {}
}
</script>
版权声明
本文为[画不完的饼]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_39162041/article/details/108885019
边栏推荐
猜你喜欢
随机推荐
欢迎使用Markdown编辑器
.Net Core 下使用 Quartz —— 【1】快速开始
js获取链接?后边的参数名称或者值,根据url ?后的参数做判断
Color string conversion
Database programming of node
Redux概述
.Net Core 下使用 Quartz —— 【5】作业和触发器之触发器的通用属性和优先级
C language structure specifying initialization
freeCodeCamp----shape_calculator练习
低代码开发平台整理
Unity3D对象池的理解与小例子
1-3 NodeJS的安装之清单配置与跑项目环境
Overview of node file system and buffer
excel里有文字的数字怎么从小到大排序,而不是首数字排序
JS中的this指向
input文件上传
查漏补缺(九)---程序篇
ECMAScript历史
百度地图案例-修改地图样式
邮箱字符串判断