mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-13 20:44:24 +08:00
💄 调整帖子卡片颜色,对于宽度不低于690的图片进行铺满
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user