2025-04-02 13:46:49 +08:00
|
|
|
<template>
|
|
|
|
<div class="ecommerce-banner" :style="{ height: height }">
|
2025-04-08 16:29:47 +08:00
|
|
|
<el-carousel height="height" motion-blur :indicator-position="indicatorPos" :arrow="arrow">
|
2025-04-02 13:46:49 +08:00
|
|
|
<el-carousel-item v-for="(item, index) in list" :key="index">
|
|
|
|
<img :src="getAssetsFile(item)" />
|
|
|
|
</el-carousel-item>
|
|
|
|
</el-carousel>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script setup>
|
|
|
|
import { ref, reactive, onMounted, watch } from 'vue';
|
|
|
|
import { isEmpty, getAssetsFile } from '@/utils';
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
height: { type: String, default: '320px' },
|
|
|
|
name: { type: String, default: 'agricultural' },
|
|
|
|
imglist: {
|
|
|
|
type: Array,
|
|
|
|
default: () => {
|
|
|
|
return [];
|
|
|
|
},
|
|
|
|
},
|
2025-04-08 16:29:47 +08:00
|
|
|
indicatorPos: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
arrow: {
|
|
|
|
type: String,
|
|
|
|
default: 'hover',
|
|
|
|
},
|
2025-04-02 13:46:49 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
let nameVal = ref(props.name);
|
|
|
|
let list = reactive(props.imglist);
|
|
|
|
|
|
|
|
watch(
|
|
|
|
() => (props.list, props.imglist),
|
|
|
|
() => {
|
|
|
|
nameVal.value = props.name;
|
|
|
|
list = props.imglist;
|
|
|
|
},
|
|
|
|
{
|
|
|
|
immediate: true,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.ecommerce-banner {
|
|
|
|
width: 100%;
|
|
|
|
::v-deep() {
|
|
|
|
.el-carousel__item {
|
|
|
|
border-radius: 16px !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|