0👍
✅
First, I really dislike passing in functions as props since it sort of violates the one-way data flow principal but that’s just my opinion.
What you should do is define a default prop value for when it has not been defined.
For example
props: {
completedRejectionAssetsUpload: {
type: Function,
default: () => {}
}
}
<vue-drop-zone
ref="myVueDropzone"
id="dropzone"
:options="dropzoneOptions"
:useCustomSlot=true
@vdropzone-queue-complete="completedRejectionAssetsUpload"
>
A better option IMO is to emit an event
<vue-drop-zone
ref="myVueDropzone"
id="dropzone"
:options="dropzoneOptions"
:useCustomSlot=true
@vdropzone-queue-complete="queueComplete"
>
methods: {
queueComplete ($event) {
this.$emit('uploaded', $event)
}
}
Then parent components can choose whether or not to listen for that event
<UploadComponent @uploaded="handleUploadedEvent">
Source:stackexchange.com