Answer the question
In order to leave comments, you need to log in
How to keep track of props updates?
I actually pass it to the components through the props object.
After pressing the button, I want to validate the data of the descendants and for those who did not pass the validation, pass the add property in the props object.
However, after changing the props of the object, the child is not updated
. How to track this correctly?
Answer the question
In order to leave comments, you need to log in
An object is passed from parent to child by reference, if you do not create an object in the parent anew each time, then the child most likely simply does not see the changes.
Options:
1. Recreate the object
2. Try to use deep watch behind the object in the child:
watch: {
propsObject: {
deep: true,
handler(new, old) {
// your code
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question