advent22/ui/src/components/ImageModal.vue

35 lines
729 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">
<!-- <p class="image is-4by3"> -->
<img src="https://bulma.io/images/placeholders/1280x960.png" alt="" />
<!-- </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 02:35:39 +00:00
export default class ImageModal extends Vue {
2022-10-30 03:04:25 +00:00
modelValue!: boolean;
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>