36 lines
812 B
Vue
36 lines
812 B
Vue
<script setup lang="ts">
|
|
|
|
import type {CmsAd} from "~/api/cms/cmsAd/model";
|
|
import {getCmsAd} from "~/api/cms/cmsAd";
|
|
|
|
const ad421 = ref<CmsAd>();
|
|
const isMobile = useIsMobile();
|
|
|
|
// 请求数据
|
|
const reload = async () => {
|
|
getCmsAd(421).then(res => {
|
|
if (isMobile.value) {
|
|
res.height = '67';
|
|
}
|
|
ad421.value = res;
|
|
});
|
|
}
|
|
|
|
onMounted(() => {
|
|
reload();
|
|
});
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<div v-if="ad421" v-for="(item,index) in ad421.imageList" :key="index">
|
|
<nuxt-link :to="ad421.style" class="flex justify-center items-center relative my-4">
|
|
<el-image class="absolute" :src="item.url" :style="`width: ${ad421.width ? ad421.width + 'px' : 'auto'}; height: ${ad421.height ? ad421.height + 'px' : 'auto'};`" />
|
|
</nuxt-link>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped lang="scss">
|
|
|
|
</style>
|