You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-pc/pages/index/module/Banner.vue

86 lines
1.7 KiB

3 years ago
<!--
* @Author: ch
* @Date: 2022-05-04 17:50:33
* @LastEditors: ch
* @LastEditTime: 2022-06-01 11:40:32
3 years ago
* @Description: file content
-->
<template>
<div class="home-banner">
<el-carousel height="360px" indicator-position="outside">
3 years ago
<el-carousel-item v-for="item in data" :key="item.id">
3 years ago
<el-image
3 years ago
@click="onBannerClick(item)"
:src="item.pictureUrl"
fit="cover"
></el-image>
</el-carousel-item>
</el-carousel>
</div>
3 years ago
</template>
<script>
3 years ago
import { AD_JUMP_TYPE } from '@/plugins/dicts/ad';
3 years ago
export default {
name: "HomtBanner",
3 years ago
props : {
data : {
type : Array,
default : () => ([])
}
},
data() {
return {
};
},
methods: {
3 years ago
onBannerClick(item) {
switch (item.jumpType) {
case AD_JUMP_TYPE.GOODS:
window.open(`${location.origin}/goods/detail/${item.jumpUrl}`);
break;
case AD_JUMP_TYPE.CATEGORY:
window.open(`${location.origin}/goods/list?id=${item.jumpUrl}&levelType=2`);
break;
3 years ago
case AD_JUMP_TYPE.LINK:
window.open(item.jumpUrl, '_blank');
break;
default:
break
}
3 years ago
}
},
};
3 years ago
</script>
<style lang="scss" scoped>
.home-banner {
@include layout-box;
/deep/.el-carousel {
.el-carousel__container {
i {
font-size: 18px;
}
}
.el-carousel__arrow {
width: 45px;
height: 45px;
}
.el-carousel__indicators {
display: none;
}
.el-carousel__arrow--left {
left: calc(50% - 550px) !important;
}
.el-carousel__arrow--right {
right: calc(50% - 550px) !important;
}
.el-image {
width: 100%;
height: 100%;
cursor: pointer;
}
}
}
</style>