// 轮播组件
<template>
<div class="swiper-box" :style="{width: width, height: height}" :class="swiperClass || ''">
<i class="el-icon-arrow-left" role="button" @click="active=active>0 ? active-1 : list.length-1" v-show="!noShowDot && list.length>1"></i>
<i class="el-icon-arrow-right" role="button" @click="active=active<list.length-1?active+1:0" v-show="!noShowDot && list.length>1"></i>
<div class="el flex align-center justify-center" v-for="(item,i) in list" :key="i"
:style="{transform: `translate(${(i-active)*100}%, 0%)`}">
........
</div>
</div>
</template>
<script>
export default {
props: {
active: {
type: Number,
default: 0
},
list: Array,
width: String,
height: String,
swiperClass: String,
noShowDot: Boolean
},
data () {
return {
}
},
methods: {
}
}
</script>
<style scoped lang="less">
@import "../assets/less/variable";
.swiper-box {
width: 80vw;
height: 70vh;
position: relative;
overflow: hidden;
img, video {
max-width: 100%;
max-height: 100%;
}
.el {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
transition: all .4s ease-in-out;
}
.el-icon-arrow-left, .el-icon-arrow-right {
position: absolute;
top: 40%;
left: 5px;
border: 1px solid @border;
border-radius: 50%;
background: @gray6;
color: @gray3;
font-size: 40px;
width: 50px;
height: 50px;
text-align: center;
line-height: 50px;
z-index: 10;
}
.el-icon-arrow-right {
right: 5px;
left: auto;
cursor: pointer;
}
}
</style>
轮播组件
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...