Skip to content

Commit

Permalink
feat(v-file-upload): allow string as initial value
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitano committed Nov 2, 2021
1 parent f4cc3b2 commit e9ca735
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/VFileUpload/VFileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import VInput from '../VInput/VInput.vue';
import {ErrorMessage} from 'vee-validate';
import {AnyMessageParams} from 'yup/lib/types';
type FileValue = File | FileList | File[] | Record<string, any> | null;
type FileValue = File | FileList | File[] | Record<string, any> | string | null;
const props = defineProps({
value: {
Expand Down Expand Up @@ -228,6 +228,11 @@ const setInitialValue = (val: any) => {
const isFile = val instanceof File;
const isFileList = val instanceof FileList;
if (typeof val === 'string') {
hasInitialValue.value = true;
previewURL.value = val;
}
if (isFile || isFileList) {
innerValue.value = val;
}
Expand Down

0 comments on commit e9ca735

Please sign in to comment.