S
S
Sergey Khlopov2019-08-06 14:13:34
Vue.js
Sergey Khlopov, 2019-08-06 14:13:34

How can a parent component tell a child component to do something?

  • The parent component is the submit form;
  • The child component - dopzone for uploading an image, inside which import vue2Dropzone from 'vue2-dropzone'vue2Dropzone is connected - was downloaded using npm, made it so that all dropzone settings would still be in a separate component and not in the submit form (parent component).

The problem is that when the form is successfully submitted, I clear all the properties datathat are associated with the form fields, but the thumbnail of the uploaded image remains in the markup . in datathe uploaded image there is only an image object in order to save the image on the server.
The question is how to pass information from the form component to the child component about what needs to be removed from the image markup. Removal is done by the dropzone method removeAllFiles(true)
I suppose that I probably need to pass the input parameter to the child component from the parent? What kind of type Boolean?
Thank you in advance for your response.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-08-06
@Shlop

Put a ref on your dropzone: When you need to clear it, call the method:
this.$refs.dropzone.removeAllFiles(true)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question