advent22/ui/src/components/ImageModal.vue

37 lines
735 B
Vue
Raw Normal View History

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">
2022-11-04 01:11:20 +00:00
<div class="image is-square">
<img :src="imageUrl" alt="Kalender-Bild" />
</div>
2022-10-30 02:35:39 +00:00
</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>