Fix app links icon upload
This commit is contained in:
@@ -28,6 +28,7 @@ const busy = ref(false);
|
||||
|
||||
watchEffect(() => {
|
||||
internalSrc.value = props.src;
|
||||
isChanged.value = false;
|
||||
});
|
||||
|
||||
function dataURLtoFile(dataURL, filename) {
|
||||
@@ -70,6 +71,7 @@ async function onSave() {
|
||||
function onCancel() {
|
||||
internalSrc.value = props.src || props.fallbackSrc;
|
||||
isChanged.value = false;
|
||||
emit('changed', 'src');
|
||||
}
|
||||
|
||||
function onEdit() {
|
||||
@@ -77,14 +79,17 @@ function onEdit() {
|
||||
}
|
||||
|
||||
async function onUnset() {
|
||||
if (typeof props.unsetHandler !== 'function') return;
|
||||
|
||||
busy.value = true;
|
||||
|
||||
const error = await props.unsetHandler();
|
||||
if (!error) isChanged.value = false;
|
||||
if (typeof props.unsetHandler === 'function') {
|
||||
const error = await props.unsetHandler();
|
||||
if (!error) isChanged.value = false;
|
||||
} else {
|
||||
isChanged.value = false;
|
||||
}
|
||||
|
||||
internalSrc.value = props.fallbackSrc;
|
||||
emit('changed', 'fallback');
|
||||
|
||||
busy.value = false;
|
||||
}
|
||||
@@ -142,7 +147,7 @@ function onChanged(event) {
|
||||
|
||||
internalSrc.value = canvas.toDataURL('image/png');
|
||||
isChanged.value = true;
|
||||
emit('changed', file); // <— notify parent
|
||||
emit('changed', file);
|
||||
};
|
||||
|
||||
image.src = fr.result;
|
||||
@@ -178,6 +183,8 @@ function onError() {
|
||||
<template v-else-if="mode === 'simple'">
|
||||
<div class="image-picker-actions">
|
||||
<Button @click.stop="onEdit" tool small icon="fa fa-pencil-alt" :disabled="busy"/>
|
||||
<Button v-if="isChanged" @click.stop="onCancel" secondary tool small icon="fa fa-undo" :disabled="busy"/>
|
||||
<Button v-else-if="internalSrc !== fallbackSrc" @click.stop="onUnset" tool small icon="fa fa-trash" :loading="busy" :disabled="busy"/>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user