Answer the question
In order to leave comments, you need to log in
Vue. How can a child component call the parent's props?
There is a parent component that can accept <slot />
, and some props
How in <slot />
(children), use methods (or props) of the parent component? If this can be implemented in Vue somehow and is the correct approach in general.
I write in react, you can override children there:
children = React.Children.toArray(children).map(child=> {
return React.cloneElement(child, {
active,
_onChange: (value, label)=> onChange(value, label),
...child.props
});
});
Answer the question
In order to leave comments, you need to log in
You can reach the parent through this.$parent.
But I would beat my hands with a stick for it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question