diff --git a/src/components/QrCodeUploadDialog.vue b/src/components/QrCodeUploadDialog.vue index 3625286a..e5d870c8 100644 --- a/src/components/QrCodeUploadDialog.vue +++ b/src/components/QrCodeUploadDialog.vue @@ -41,7 +41,10 @@ const inputFile = (() => { })(); reader.addEventListener('load', () => { - if (typeof reader.result === 'string') imageUrl.value = reader.result; + if (typeof reader.result === 'string') { + imageUrl.value = reader.result; + if (!dialogState.value) emit('save', file.value, imageUrl.value); + } }); function browse() { @@ -51,13 +54,9 @@ function browse() { function change(e: Event) { const _element = e.target as HTMLInputElement | null; const _file = _element?.files?.[0]; - if (_file) { file.value = _file; reader.readAsDataURL(_file); - if (!dialogState.value) { - emit('save', _file, imageUrl.value); - } } }