完成适配移动端

This commit is contained in:
2025-03-01 10:52:11 +08:00
parent 1f79c93859
commit 8d19a58e9d
68 changed files with 2117 additions and 847 deletions

View File

@@ -0,0 +1,81 @@
<template>
<div>
<div class="w-full bg-white mb-3 hidden-sm-and-down" v-if="ad">
<el-carousel :height="`${ad?.height || '500'}px`">
<el-carousel-item v-for="(item,index) in ad?.imageList" :key="index">
<div class="item relative flex justify-center items-center">
<el-image :src="item.url" fit="cover" class="w-full" :style="`height: ${ad?.height}px;`" />
<!-- fit: '' | 'fill' | 'contain' | 'cover' | 'none' | 'scale-down'-->
</div>
{{ad.height}}==
</el-carousel-item>
</el-carousel>
</div>
<!-- 移动端 -->
<div class="sm:hidden w-full bg-white mt-[48px] mb-3 hidden-sm-and-up" v-if="ad">
<el-carousel indicator-position="none" height="150">
<el-carousel-item v-for="(item,index) in ad?.imageList" :key="index">
<el-image :src="item.url" />
</el-carousel-item>
</el-carousel>
</div>
</div>
</template>
<script setup lang="ts">
import type {CompanyParam} from "~/api/system/company/model";
import type {CmsAd} from "~/api/cms/cmsAd/model";
import {pageCmsAd} from "~/api/cms/cmsAd";
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 () => {
pageCmsAd({
type: 1,
lang: getLang()
}).then(res => {
console.log(res)
if(res){
ad.value = res.list[0];
}
})
}
watch(
() => props.config,
() => {
reload();
},
{immediate: true}
);
</script>
<style>
.hidden-sm-and-up .el-carousel{
height: 160px;
}
</style>