Answer the question
In order to leave comments, you need to log in
How to pass object NOT by reference from parent component to child?
Is it possible to somehow pass an object to a child component via props so that changing the object in the child component does not affect the object in the parent, and changing the parent affects the object in the child, i.e. so that the logic of work is the same as with simple variable types?
If not, then there may be other solutions.
Answer the question
In order to leave comments, you need to log in
If I understand you correctly, you can do this:
<parent>
<child :some_prop="parent_obj"></child>
</parent>
<script>
export default {
props: ['some_prop'],
data: function() {
return {
innerProp: {...this.some_prop}
}
}
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question