antares/src/renderer/components/ModalDiscardChanges.vue

50 lines
1.0 KiB
Vue
Raw Normal View History

2020-12-04 11:19:16 +01:00
<template>
<ConfirmModal
:confirm-text="$t('word.discard')"
:cancel-text="$t('word.stay')"
2021-07-16 23:24:55 +02:00
@confirm="$emit('confirm')"
@hide="$emit('close')"
2020-12-04 11:19:16 +01:00
>
2021-12-10 17:34:44 +01:00
<template #header>
2020-12-04 11:19:16 +01:00
<div class="d-flex">
<i class="mdi mdi-24px mdi-content-save-alert mr-1" /> {{ $t('message.unsavedChanges') }}
</div>
</template>
2021-12-10 17:34:44 +01:00
<template #body>
2020-12-04 11:19:16 +01:00
<div>
{{ $t('message.discardUnsavedChanges') }}
</div>
2021-12-10 17:34:44 +01:00
</template>
2020-12-04 11:19:16 +01:00
</ConfirmModal>
</template>
<script>
import ConfirmModal from '@/components/BaseConfirmModal';
export default {
name: 'ModalDiscardChanges',
components: {
ConfirmModal
},
created () {
window.addEventListener('keydown', this.onKey);
},
2022-04-21 14:39:24 +02:00
beforeUnmount () {
2020-12-04 11:19:16 +01:00
window.removeEventListener('keydown', this.onKey);
},
methods: {
onKey (e) {
e.stopPropagation();
if (e.key === 'Escape')
this.closeModal();
}
}
};
</script>
<style scoped>
.modal-container {
max-width: 360px;
}
</style>