I have a component called BaseFile
components/BaseFile.vue
<template>
<div>
<b-form-group :label="label">
<b-form-file
:value="value"
:placeholder="placeholder"
:accept="acceptedExtensions"
@input="updateValue">
</b-form-file>
</b-form-group>
</div>
</template>
<script>
export default {
name: 'BaseFile',
props: {
label: { type: String },
value: { type: Object },
placeholder: { type: String, default: "Choose a file..." },
acceptedExtensions: { type: String, default: "image/jpeg, image/png" }
},
methods: {
updateValue(value) {
// console.log(typeof value)
// console.log(event.target.value)
this.$emit('input', value);
}
}
}
</script>
then I'm calling this component in my Users/new.vue
<BaseFile label="Primary Image" v-model="primaryImage"/>
<script>
import BaseFile from "~/components/UI/BaseFile";
export default {
components: {
BaseFile
},
data() {
return {
profileImage: {}
}
}
</script>
when I try to add a file in BaseFile component, the error I'm getting is
Invalid prop: type check failed for prop "value". Expected Object, got File.
I checked the documentation of Vue and there's no available props for File. But I need file because I'm uploading it directly to s3.
File? I actually tested this on my local and did not get this prop check warning.File is not defined