Answers for "focus on child components on single page applications - 2"

0

focus on child components on single page applications - 2

<template>
  <div>
    <input type="text" ref="childInput" />
  </div>
</template>

<script>
export default {
  name: 'child',
  mounted() {
    this.$root.$on('focusChildInput', () => this.$refs.childInput.focus());
  },
};
</script>
Posted by: Guest on January-02-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language