Skip to content

Commit

Permalink
💄 优化图片加载显示
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Sep 2, 2024
1 parent e7b176f commit 49a9060
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/post/tp-image.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<template>
<div class="tp-image-box" @click="showOverlay = true">
<div class="tp-image-box" @click="showOverlay = true" v-if="localUrl !== undefined">
<img :src="localUrl" :alt="props.data.insert.image" :title="getImageTitle()" />
</div>
<div v-else class="tp-image-load" :title="getImageUrl()">
<v-progress-circular indeterminate color="primary" size="small" />
<span>加载中...</span>
</div>
<TpoImage :image="props.data" v-model="showOverlay" />
</template>
<script lang="ts" setup>
Expand Down Expand Up @@ -31,7 +35,7 @@ interface TpImageProps {
const props = defineProps<TpImageProps>();
const showOverlay = ref(false);
const localUrl = ref<string>();
const localUrl = ref<string | undefined>(undefined);
console.log("tp-image", props.data.insert.image, props.data.attributes);
Expand Down Expand Up @@ -80,4 +84,12 @@ function getImageUrl(): string {
border-radius: 10px;
cursor: pointer;
}
.tp-image-load {
display: flex;
align-items: center;
justify-content: center;
margin: 10px auto;
column-gap: 5px;
}
</style>

0 comments on commit 49a9060

Please sign in to comment.