V
V
Valery V.2019-02-04 14:59:51
Vue.js
Valery V., 2019-02-04 14:59:51

How to pass $refs to another Vue component?

Good afternoon!
There is a parent component, it has a $refs.element element
How to pass this reference to the element to the child component?
Well, or how to get access from the child component to this element in the parent component?
UDP: $parent is only suitable for the immediate parent, needs access to any ancestor in the hierarchy.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WebDev, 2019-02-04
@kirill-93

The child component has a $parent property - this is the parent component.
Accordingly, in the child component:
this.$parent.$refs

E
Evgeny Kulakov, 2019-02-04
@kulakoff Vue.js

Why not just pass this $refs.element to the props of the child component.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question