Commit 4e511b5d by zl

fix

parent 79c1449d
<script setup>
import { ref, defineProps } from 'vue';
const props = defineProps(['src']);
import { ref } from 'vue'
defineProps({
src: {
type: String,
required: true,
},
alt: {
type: String,
default: '',
},
})
const isOpen = ref(false)
const popupImage = ref(null);
const open = () => {
popupImage.value.style.display = 'block';
};
isOpen.value = true
}
const close = () => {
popupImage.value.style.display = 'none';
isOpen.value = false
}
</script>
<img class="original-image" :src="props.src" @click="open()">
<template>
<figure class="big-image">
<img class="original-image" :src="src" :alt="alt" @click="open">
<div class="popup-image" ref="popupImage" @click="close">
<img :src="props.src" @click="$event.stopPropagation()" />
</div>
<div v-show="isOpen" class="popup-image" @click="close">
<img :src="src" :alt="alt" @click.stop>
</div>
</figure>
</template>
<style>
.big-image {
margin: 0;
}
.original-image {
margin-bottom: 20px;
cursor: pointer;
display: block;
}
.popup-image {
position: fixed;
width: 100%;
......@@ -32,8 +52,8 @@ const close = () => {
top: 0;
left: 0;
z-index: 30;
display: none;
}
.popup-image img {
position: absolute;
top: 50%;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment