Answers for "what is emit in vuejs"

6

vuejs emit

<!--
 From the child component, you want to do an "emit".
 This tells the parent to run the callback specified
 in the child component reference. Psuedo code:
-->
<child>
    <button @click="send">Click Me</button>

    methods: {
      send() {
    	Vue.$emit('send', 'Hello World');
      }
    }
</child>

<parent>
  <child @send="receive"></child>
    
    methods: {
      receive(childData) {
        console.log(childData); // "Hello World"
      }
    }
</parent>
Posted by: Guest on July-28-2021
1

how emit in input in vue

<input  @change="$emit('modelInput' , inputValueModel)"  >
Posted by: Guest on June-02-2021
0

vue 3 emits

<template>
  <div>
    <p>{{ text }}</p>
    <button v-on:click="$emit('accepted')">OK</button>
  </div>
</template>
<script>
  export default {
    props: ['text'],
    emits: ['accepted']
  }
</script>
Posted by: Guest on March-26-2021

Browse Popular Code Answers by Language