Answer the question
In order to leave comments, you need to log in
How to pass value from one vue to another?
Good afternoon! Essence of the question:
There are three vue:
SomeTree (1)
SomeTreeItem (2)
SomeTreeItemContextMenu (3)
In (2) there is a method that returns a value that needs to be passed to (3), while (3) can only be reached through (1 )
Answer the question
In order to leave comments, you need to log in
Ultimate methods:
localStorage
window.youVar
And so specify.
If this is a single VUE instance, then just use the data of the main component, or store, or EventBus
https://medium.com/@andrejsabrickis/https-medium-c...
If these are just random components, then the method can be obtained through ref
and passed to another component through props
. Only "pass methods" - not in the ideology of Vue.
If it is necessary to call the action of another from one component, the first one should call the event ( $emit
) and the parent component should catch it ( @event
) and perform the desired action.
However, if there is a container element in which there is a complex and / or recursive nesting and which combines the functionality of children, such a component can pass ( provide
) an object common to all children, who will receive it ( inject
) and use it together.
postMessage it seems it is possible? If anything, correct mench
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question