refactor: use vuetify form controls
This commit is contained in:
@@ -44,7 +44,6 @@
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'save']);
|
||||
|
||||
const fileInput = ref(null);
|
||||
const cropper = ref(null);
|
||||
const imageUrl = ref(null);
|
||||
const remoteUrl = ref('');
|
||||
@@ -67,17 +66,11 @@
|
||||
imageUrl.value = props.initialUrl || null;
|
||||
remoteUrl.value = props.initialUrl || '';
|
||||
error.value = null;
|
||||
if (fileInput.value) {
|
||||
fileInput.value.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
function chooseImage() {
|
||||
fileInput.value?.click();
|
||||
}
|
||||
function onFileSelected(value) {
|
||||
const file = Array.isArray(value) ? value[0] : value;
|
||||
|
||||
function onFileSelected(event) {
|
||||
const [file] = event.target.files ?? [];
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
@@ -165,28 +158,25 @@
|
||||
</div>
|
||||
|
||||
<div class="cropper-actions">
|
||||
<input
|
||||
ref="fileInput"
|
||||
type="file"
|
||||
<v-file-input
|
||||
:label="uploadLabel"
|
||||
accept="image/*"
|
||||
class="hidden-input"
|
||||
@change="onFileSelected"
|
||||
/>
|
||||
|
||||
<button
|
||||
class="action-button"
|
||||
:disabled="isSaving"
|
||||
@click="chooseImage"
|
||||
>
|
||||
{{ uploadLabel }}
|
||||
</button>
|
||||
density="compact"
|
||||
variant="outlined"
|
||||
hide-details
|
||||
@update:model-value="onFileSelected"
|
||||
/>
|
||||
<div class="url-controls">
|
||||
<input
|
||||
<v-text-field
|
||||
v-model="remoteUrl"
|
||||
type="url"
|
||||
class="url-input"
|
||||
:placeholder="sourceLabel"
|
||||
:disabled="isSaving"
|
||||
density="compact"
|
||||
variant="outlined"
|
||||
hide-details
|
||||
/>
|
||||
<button
|
||||
class="action-button secondary"
|
||||
|
||||
Reference in New Issue
Block a user