Created
February 12, 2018 04:26
-
-
Save coderdiaz/47b253158460c694aaa9d843261c09ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="hijo-component"> | |
<h1>Hijo</h1> | |
<button @click.prevent="emitirEventoHijo"></button> | |
</div> | |
</template> | |
<script> | |
import {EventBus} from './event-bus' | |
export default { | |
name: 'Hijo', | |
created () { | |
EventBus.$on('padre:change', () => { | |
console.log('Mensaje del padre recibido') | |
}) | |
}, | |
methods: { | |
emitirEventoHijo() { | |
EventBus.$emit('hijo:change') | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment