antares/src/renderer/components/ModalDiscardChanges.vue

45 lines
1014 B
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')"
@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 setup lang="ts">
import ConfirmModal from '@/components/BaseConfirmModal.vue';
import { onBeforeUnmount } from 'vue';
2020-12-04 11:19:16 +01:00
const emit = defineEmits(['confirm', 'close']);
const onKey = (e: KeyboardEvent) => {
e.stopPropagation();
if (e.key === 'Escape')
emit('close');
2020-12-04 11:19:16 +01:00
};
window.addEventListener('keydown', onKey);
onBeforeUnmount(() => {
window.removeEventListener('keydown', onKey);
});
2020-12-04 11:19:16 +01:00
</script>
<style scoped>
.modal-container {
max-width: 360px;
}
</style>