fix: select same image result in image not change

This commit is contained in:
Methapon2001 2024-12-11 13:28:49 +07:00
parent 0bd5b3dcb1
commit 6f9e693c58

View file

@ -52,12 +52,14 @@ const onCreateData = defineModel<{
const apiBaseUrl = import.meta.env.VITE_API_BASE_URL;
const reader = new FileReader();
const inputFile = (() => {
const { inputFile, resetInputFile } = (() => {
const _form = document.createElement('form');
const _element = document.createElement('input');
_element.type = 'file';
_element.accept = 'image/*';
_element.addEventListener('change', change);
return _element;
_form.appendChild(_element);
return { inputFile: _element, resetInputFile: () => _form.reset() };
})();
const selectedImg = ref('');
@ -83,6 +85,7 @@ reader.addEventListener('load', () => {
});
function browse() {
resetInputFile();
inputFile?.click();
}
@ -219,11 +222,7 @@ watch(
unelevated
round
v-if="!changeDisabled"
@click="
() => {
inputFile?.click();
}
"
@click="browse"
style="color: hsla(var(--stone-0-hsl) / 0.7)"
></q-btn>
<q-btn