Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #focus #child #components #single #page #applications
ADD COMMENT
Topic
Name
6+9 =