vue js set a component to $refs code example
Example 1: vuejs ref
<template>
<input ref="input">
</template>
<script>
export default {
methods: {
// used to put the focus on this field from the parent
focus() {
this.$refs.input.focus();
}
}
};
</script>
Example 2: passing $refs inner component vue
<user>
<user-item ref="details"></user-item>
<permissions :parentRefs="$refs"></permissions>
</user>