fix: headless cause side effect
This commit is contained in:
parent
71a7abc93b
commit
e0d18401fb
1 changed files with 3 additions and 6 deletions
|
|
@ -1,5 +1,4 @@
|
|||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import AppBox from './app/AppBox.vue';
|
||||
|
||||
defineExpose({ browse });
|
||||
|
|
@ -37,7 +36,6 @@ const inputFile = (() => {
|
|||
_element.addEventListener('change', change);
|
||||
return _element;
|
||||
})();
|
||||
const headless = ref(false);
|
||||
|
||||
reader.addEventListener('load', () => {
|
||||
if (typeof reader.result === 'string') imageUrl.value = reader.result;
|
||||
|
|
@ -45,7 +43,6 @@ reader.addEventListener('load', () => {
|
|||
|
||||
function browse() {
|
||||
inputFile?.click();
|
||||
headless.value = true;
|
||||
}
|
||||
|
||||
function change(e: Event) {
|
||||
|
|
@ -55,10 +52,10 @@ function change(e: Event) {
|
|||
if (_file) {
|
||||
file.value = _file;
|
||||
reader.readAsDataURL(_file);
|
||||
if (headless) emit('save', _file, imageUrl.value);
|
||||
if (!dialogState.value) {
|
||||
emit('save', _file, imageUrl.value);
|
||||
}
|
||||
}
|
||||
|
||||
headless.value = false;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue