Search
 
SCRIPT & CODE EXAMPLE
 

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>
Comment

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>
Comment

PREVIOUS NEXT
Code Example
Javascript :: nested destructuring in javascript 
Javascript :: update instance in sequelize 
Javascript :: print multidimensional array javascript using loop 
Javascript :: pixijs circle 
Javascript :: FTP upload local file 
Javascript :: fetch image from cloudinary in nodejs 
Javascript :: how to do multi ban discord.js 
Javascript :: jq add variable 
Javascript :: hide header title in react navigation Drawer navigation 
Javascript :: json data find 
Javascript :: cannot Nesting classes sass nextjs 
Javascript :: private class members javascript 
Javascript :: vue block other script event listeners 
Javascript :: sw.js 
Javascript :: Including soft deleted records 
Javascript :: server starter code in js 
Javascript :: compile regex script help online 
Javascript :: Moralis Password reset web3 
Javascript :: foreach doesnt return 
Javascript :: slice method javascript 
Javascript :: to see all function attribute and methods in javascript 
Javascript :: unable to append div multiple times 
Javascript :: Function for masking the character 
Javascript :: min expression postgresql 
Javascript :: datatable editable row update other cell 
Javascript :: promtail +verbose 
Javascript :: how to format date dd/mm/yyyy in javascript 
Javascript :: Adding Notices in the Block Editor Wordpress 
Javascript :: format file using jq 
Javascript :: send offer webrtc 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =