new comment and fix picture
This commit is contained in:
@@ -361,6 +361,10 @@ tr {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hfill {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.w-10vw {
|
.w-10vw {
|
||||||
width: 10vw;
|
width: 10vw;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 3.3 MiB |
@@ -1,16 +1,18 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted } from "vue";
|
import { ref, computed, onMounted, onUnmounted } from "vue";
|
||||||
import { Transition } from "vue";
|
import { Transition } from "vue";
|
||||||
|
|
||||||
const images = [
|
const images = [
|
||||||
"/img/memes/pidgeon.gif",
|
{ url: "/img/memes/pidgeon.gif", comment: "鸟" },
|
||||||
"/img/memes/no_slip.png",
|
//{ url: "/img/memes/no_slip.png" },
|
||||||
"/img/memes/epic.jpeg",
|
//{ url: "/img/memes/epic.jpeg" },
|
||||||
"/img/bedroom/img2.png",
|
{ url: "/img/bedroom/img2.png", comment: "办公桌" },
|
||||||
"/img/bedroom/img1.png",
|
{ url: "/img/bedroom/img1.png", comment: "床" },
|
||||||
];
|
];
|
||||||
|
|
||||||
const currentIndex = ref(0);
|
const currentIndex = ref(0);
|
||||||
|
const currentComment = computed(() => images[currentIndex.value].comment);
|
||||||
|
const currentUrl = computed(() => images[currentIndex.value].url);
|
||||||
|
|
||||||
function nextImage() {
|
function nextImage() {
|
||||||
let newIndex;
|
let newIndex;
|
||||||
@@ -32,21 +34,23 @@ onUnmounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="image-viewer" @click="nextImage">
|
|
||||||
<Transition name="fade" mode="out-in">
|
<Transition name="fade" mode="out-in">
|
||||||
<img
|
<div
|
||||||
:src="images[currentIndex]"
|
class="image-viewer center-text"
|
||||||
|
@click="nextImage"
|
||||||
:key="currentIndex"
|
:key="currentIndex"
|
||||||
alt="Image Viewer"
|
>
|
||||||
/>
|
<p v-if="currentComment">
|
||||||
</Transition>
|
{{ currentComment }}
|
||||||
|
</p>
|
||||||
|
<img :src="currentUrl" alt="Image Viewer" />
|
||||||
</div>
|
</div>
|
||||||
|
</Transition>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.image-viewer {
|
.image-viewer {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user