74 lines
1.7 KiB
Vue
74 lines
1.7 KiB
Vue
<template>
|
|
<div class="lg:my-3 my-0 relative">
|
|
<el-carousel :height="flashHeight + 'px'" :interval="2000" motion-blur indicator-position="none">
|
|
<el-carousel-item v-for="(item,index) in data" :key="index">
|
|
<nuxt-link :to="`/detail/${item.articleId}.html`" class="item flex justify-center items-center">
|
|
<el-image :src="`${FILE_SERVER}${item.image}`" class="w-[500px] h-[380px]" />
|
|
<div class="absolute bottom-0 z-100 w-[468px] bg-black opacity-80 font-bold px-4 line-clamp-1 text-sm lg:text-lg">
|
|
<span class="text-white">{{ item.title }}</span>
|
|
</div>
|
|
</nuxt-link>
|
|
</el-carousel-item>
|
|
</el-carousel>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type {CompanyParam} from "~/api/system/company/model";
|
|
import type {CmsArticle} from "~/api/cms/cmsArticle/model";
|
|
import {FILE_SERVER} from "~/config";
|
|
|
|
const isMobile = useIsMobile();
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
data?: CmsArticle[];
|
|
disabled?: boolean;
|
|
title?: string;
|
|
comments?: string;
|
|
}>(),
|
|
{
|
|
title: '卡片标题',
|
|
comments: '卡片描述'
|
|
}
|
|
);
|
|
|
|
const emit = defineEmits<{
|
|
(e: 'done'): void;
|
|
}>();
|
|
const loading = ref(false);
|
|
const list = ref<CmsArticle[]>([]);
|
|
const flashHeight = ref<number>(372)
|
|
|
|
// 搜索表单
|
|
const where = reactive<CompanyParam>({
|
|
keywords: ''
|
|
});
|
|
|
|
// 请求数据
|
|
const reload = async () => {
|
|
loading.value = true;
|
|
if(isMobile.value){
|
|
flashHeight.value = 260;
|
|
}
|
|
setTimeout(() => {
|
|
list.value = props.data || [];
|
|
loading.value = false;
|
|
},500)
|
|
}
|
|
|
|
watch(
|
|
() => props.data,
|
|
() => {
|
|
reload();
|
|
},
|
|
{immediate: true}
|
|
);
|
|
</script>
|
|
|
|
<style>
|
|
.hidden-sm-and-up .el-carousel{
|
|
height: 160px;
|
|
}
|
|
</style>
|