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

0

focus on child components on single page applications - 1

<template>
  <div>
    <button type="button" @click="focusChildInput">Focus to Input</button>
    <child />
  </div>
</template>

<script>
import child from './child.vue';

export default {
  name: 'app',
  components: { child },
  methods: {
    focusChildInput() {
      this.$root.$emit('focusChildInput');
    },
  },
};
</script>
Posted by: Guest on January-02-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language