0👍
✅
From the Vue docs:
An important note about the ref registration timing: because the refs themselves are created as a result of the render function, you cannot access them on the initial render – they don’t exist yet!
Looks like the mounted
event is too early to grab the $refs
. Move this code closer to where you actually need the value of the input
tag.
0👍
Check if you are actually using the component – did you add it into your components
after the import?
0👍
You can use an alternative way.
Make an event (like this.$emit('loaded');
) in mounted
method of your child componenent and use a function in your component to get $ref
Source:stackexchange.com