【优化】优化画廊样式

pull/483/head
cherishsince 2024-07-17 13:49:06 +08:00
parent a854e96343
commit ccf21dd4d4
1 changed files with 37 additions and 16 deletions

View File

@ -1,23 +1,22 @@
<template> <template>
<div class="card-list"> <div class="gallery">
<div v-for="item in publicList" :key="item.id" class="card"> <div v-for="item in publicList" :key="item" class="gallery-item">
<img :src="item.picUrl" class="img" /> <img :src="item.picUrl" class="img"/>
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ImageApi, ImageVO } from '@/api/ai/image' import { ImageApi, ImageVO, ImageMidjourneyButtonsVO } from '@/api/ai/image'
/** 属性 */ /** 属性 */
// TODO @fanqueryParams
const pageNo = ref<number>(1) const pageNo = ref<number>(1)
const pageSize = ref<number>(20) const pageSize = ref<number>(20)
const publicList = ref<ImageVO[]>([]) const publicList = ref<ImageVO[]>([])
/** 获取数据 */ /** 获取数据 */
const getListData = async () => { const getListData = async () => {
const res = await ImageApi.getImagePagePublic({ pageNo: pageNo.value, pageSize: pageSize.value }) const res = await ImageApi.getImagePagePublic({pageNo: pageNo.value, pageSize: pageSize.value});
publicList.value = res.list as ImageVO[] publicList.value = res.list as ImageVO[];
console.log('publicList.value', publicList.value) console.log('publicList.value', publicList.value)
} }
@ -26,16 +25,38 @@ onMounted(async () => {
}) })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.card-list {
//display: flex; .gallery {
//flex-direction: column; display: grid;
column-count: 4; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
column-gap: 3px; gap: 10px;
//max-width: 1000px;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
} }
.card { .gallery-item {
.img { position: relative;
width: 50%; overflow: hidden;
} background: #f0f0f0;
cursor: pointer;
transition: transform 0.3s;
} }
.gallery-item img {
width: 100%;
height: auto;
display: block;
transition: transform 0.3s;
}
.gallery-item:hover img {
transform: scale(1.1);
}
.gallery-item:hover {
transform: scale(1.05);
}
</style> </style>