💄 调整帖子卡片颜色,对于宽度不低于690的图片进行铺满

This commit is contained in:
目棃
2024-09-07 10:55:15 +08:00
parent 3517f9182a
commit 5bc687109b
2 changed files with 14 additions and 7 deletions

View File

@@ -3,13 +3,13 @@
<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" />
<v-progress-circular :indeterminate="true" color="primary" size="small" />
<span>加载中...</span>
</div>
<TpoImage :image="props.data" v-model="showOverlay" />
</template>
<script lang="ts" setup>
import { ref, onMounted, onUnmounted } from "vue";
import { computed, ref, onMounted, onUnmounted } from "vue";
import { saveImgLocal } from "../../utils/TGShare.js";
import { bytesToSize } from "../../utils/toolFunc.js";
@@ -37,6 +37,12 @@ const props = defineProps<TpImageProps>();
const showOverlay = ref(false);
const localUrl = ref<string | undefined>(undefined);
const imgWidth = computed<string>(() => {
if (props.data.attributes === undefined) return "auto";
if (props.data.attributes.width >= 690) return "100%";
return `${props.data.attributes.width}px`;
});
console.log("tp-image", props.data.insert.image, props.data.attributes);
onMounted(async () => {
@@ -79,6 +85,7 @@ function getImageUrl(): string {
}
.tp-image-box img {
width: v-bind(imgWidth);
max-width: 100%;
height: auto;
border-radius: 10px;