2022-10-30 02:35:39 +00:00
|
|
|
<template>
|
2022-10-30 03:04:25 +00:00
|
|
|
<div class="modal is-active" v-if="modelValue" @click="hide">
|
2022-10-30 02:35:39 +00:00
|
|
|
<div class="modal-background" />
|
|
|
|
|
|
|
|
<div class="modal-content">
|
|
|
|
<!-- <p class="image is-4by3"> -->
|
2022-10-30 03:10:07 +00:00
|
|
|
<img :src="imageUrl" alt="" />
|
2022-10-30 02:35:39 +00:00
|
|
|
<!-- </p> -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2022-10-30 03:04:25 +00:00
|
|
|
import { Options, Vue } from "vue-class-component";
|
2022-10-30 02:35:39 +00:00
|
|
|
|
2022-10-30 03:04:25 +00:00
|
|
|
@Options({
|
|
|
|
props: {
|
|
|
|
modelValue: Boolean,
|
2022-10-30 03:10:07 +00:00
|
|
|
imageUrl: String,
|
2022-10-30 03:04:25 +00:00
|
|
|
},
|
|
|
|
})
|
2022-10-30 02:35:39 +00:00
|
|
|
export default class ImageModal extends Vue {
|
2022-10-30 03:04:25 +00:00
|
|
|
modelValue!: boolean;
|
2022-10-30 03:10:07 +00:00
|
|
|
imageUrl!: string;
|
2022-10-30 02:35:39 +00:00
|
|
|
|
|
|
|
public created(): void {
|
|
|
|
window.addEventListener("keydown", (e) => {
|
|
|
|
if (e.key == "Escape") this.hide();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private hide(): void {
|
2022-10-30 03:04:25 +00:00
|
|
|
this.$emit("update:modelValue", false);
|
2022-10-30 02:35:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|