Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

vue emit

// This is in child component
// use this after some process in methods

this.$emit('event-name', 'Hello, I'm Suman') ——————┐
                                               	   │
// parent component                                │
<template>                                         │
  <child-component                                 │
	@event-name="someFuncToCall" <—————————————————┘
  >
  </child-component>
</template>
<script>
  export default {
    methods: {
      someFuncToCall(arg) {
        console.log(arg); //Hello, I'm Suman
      }
    }
  }
</script>
 
PREVIOUS NEXT
Tagged: #vue #emit
ADD COMMENT
Topic
Name
8+8 =