new comment and fix picture

This commit is contained in:
2026-01-20 19:55:11 +00:00
parent 2f1d562d2a
commit 926f06dfe4
3 changed files with 24 additions and 16 deletions

View File

@@ -361,6 +361,10 @@ tr {
width: 100%;
}
.hfill {
height: 100%;
}
.w-10vw {
width: 10vw;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@@ -1,16 +1,18 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, computed, onMounted, onUnmounted } from "vue";
import { Transition } from "vue";
const images = [
"/img/memes/pidgeon.gif",
"/img/memes/no_slip.png",
"/img/memes/epic.jpeg",
"/img/bedroom/img2.png",
"/img/bedroom/img1.png",
{ url: "/img/memes/pidgeon.gif", comment: "鸟" },
//{ url: "/img/memes/no_slip.png" },
//{ url: "/img/memes/epic.jpeg" },
{ url: "/img/bedroom/img2.png", comment: "办公桌" },
{ url: "/img/bedroom/img1.png", comment: "床" },
];
const currentIndex = ref(0);
const currentComment = computed(() => images[currentIndex.value].comment);
const currentUrl = computed(() => images[currentIndex.value].url);
function nextImage() {
let newIndex;
@@ -32,21 +34,23 @@ onUnmounted(() => {
</script>
<template>
<div class="image-viewer" @click="nextImage">
<Transition name="fade" mode="out-in">
<img
:src="images[currentIndex]"
:key="currentIndex"
alt="Image Viewer"
/>
</Transition>
</div>
<Transition name="fade" mode="out-in">
<div
class="image-viewer center-text"
@click="nextImage"
:key="currentIndex"
>
<p v-if="currentComment">
{{ currentComment }}
</p>
<img :src="currentUrl" alt="Image Viewer" />
</div>
</Transition>
</template>
<style scoped>
.image-viewer {
width: 100%;
height: 100%;
overflow: hidden;
}