Fix file input clear and improve upload handling
The change adds image clearing functionality and improves input validation by adding null checks and clearable state to the file input component.
This commit is contained in:
@@ -14,14 +14,17 @@
|
||||
></v-img>
|
||||
</v-avatar>
|
||||
|
||||
//No funciona $clear
|
||||
<v-file-input
|
||||
accept="image/apng, image/avif, image/gif, image/jpeg, image/png, image/svg+xml, image/webp"
|
||||
label="Subir imagen"
|
||||
@input="handleFileInput"
|
||||
type="file"
|
||||
v-model="imagen"
|
||||
click:clear="$clear"
|
||||
clearable
|
||||
/><v-btn
|
||||
color="primary"
|
||||
color="secundary"
|
||||
:disabled="files.length <= 0 || !validateFileType()"
|
||||
@click="uploadImage"
|
||||
>
|
||||
@@ -81,7 +84,9 @@ const uploadImage = async () => {
|
||||
if (response) {
|
||||
//imagenVista.value = response.image;
|
||||
files.value.pop();
|
||||
imagen.value = null;
|
||||
if (imagen.value != null) {
|
||||
imagen.value = null;
|
||||
}
|
||||
await getSession();
|
||||
} else {
|
||||
console.error(response);
|
||||
|
||||
Reference in New Issue
Block a user