使用图片懒加载

This commit is contained in:
ctw committed 2025-01-16 09:54:43 +08:00
1 parent b6f313ed78
commit 628fa5bfdc
2 files changed
+61 -49

No files matched your search

+9 -3
View File
@@ -12,7 +12,7 @@
v-for="(item, index) in weekData.data"
:key="index"
@click="timeClick(item, index)"
:class="{ selectedSpan: isActive === index ? 'selected' : '' }"
:class="{ selectedSpan: isActive === index }"
class="border-2 border-solid border-gray-200 text-center"
>
<span>{{ item }}</span>
@@ -55,7 +55,12 @@
<td v-if="!loading" class="text-center" @click="addFood(3)">晚餐</td>
<div class="food_list">
<td class="food_list_item" v-for="(item, index) in foodData3" :key="index" @click="delteData(item.tid)">
<el-image style="width: 80px; height: 80px" :src="imageBaseUrl + item.picUrl" fit="cover" />
<el-image
style="width: 80px; height: 80px"
loading="lazy"
:src="imageBaseUrl + item.picUrl"
fit="cover"
/>
<div class="w-full flex justify-around items-center text-black mt-2">
<span>{{ item.name }}</span>
<span class="mx-1">|</span>
@@ -114,7 +119,7 @@ const addFood = async (hourType: number) => {
//选中具体时间数据
const timeClick = async (time: string, index: number) => {
//数据查询操作
if (time) {
if (time && isActive.value !== index) {
//时间处理
time = time.substring(0, time.indexOf("("))
timedata = time
@@ -265,6 +270,7 @@ onMounted(async () => {
border-left: 2px solid transparent;
color: rgb(255, 187, 0);
position: relative;
cursor: default;
}
.selectedSpan::before {
content: "";