Vue:Ref
lastmod 2022-03-24created 2020-09-253 edits
Accessing child component instances and elements using the ref attribute and this.$refs.
How to use
Of course, props and events exist, but sometimes you may need to access a child element directly in JavaScript. In this case, you can solve it by assigning a reference ID to the child element using the ref attribute.
For example:
Now, in the component where you defined the ID using ref, writing the following:
lets you access the <base-input> instance.
Accessing refs in a v-for list
And use the refs in your component like this: