基于Java spring + vue3 + nuxt构建的内容管理系统
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.
 
 
 

60 lines
1.4 KiB

<template>
<div class="w-full bg-white mt-[60px] mb-3" v-if="ad">
<el-carousel indicator-position="none" :height="ad?.height">
<el-carousel-item v-for="(item,index) in ad?.imgArr" :key="index">
<div class="item relative" @click="openSpmUrl(`https://www.baidu.com`)">
<el-image :src="item.url" />
</div>
</el-carousel-item>
</el-carousel>
{{ ad?.imgArr }}
</div>
</template>
<script setup lang="ts">
import {useServerRequest} from "~/composables/useServerRequest";
import type {ApiResult, PageResult} from "~/api";
import type {CompanyParam} from "~/api/system/company/model";
import type {CmsAd} from "~/api/cms/cmsAd/model";
const props = withDefaults(
defineProps<{
config?: any;
list?: any[];
disabled?: boolean;
title?: string;
comments?: string;
}>(),
{
title: '卡片标题',
comments: '卡片描述'
}
);
const emit = defineEmits<{
(e: 'done'): void;
}>();
const ad = ref<CmsAd>();
// 搜索表单
const where = reactive<CompanyParam>({
keywords: ''
});
// 请求数据
const reload = async () => {
const {data: response} = await useServerRequest<ApiResult<PageResult<CmsAd>>>('/cms/cms-ad/page',{params: {adType: '幻灯片',pageName: '首页'}})
if (response.value?.data?.list) {
ad.value = response.value.data?.list[0];
}
}
watch(
() => props.config,
() => {
reload();
},
{immediate: true}
);
</script>