Skip to content

Instantly share code, notes, and snippets.

@ChoWonmin
Created February 4, 2020 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChoWonmin/7f8b0828fa9b51f34a1b0dbc4d56d1a0 to your computer and use it in GitHub Desktop.
Save ChoWonmin/7f8b0828fa9b51f34a1b0dbc4d56d1a0 to your computer and use it in GitHub Desktop.
vue emit
<tmplate lang="pug">
.child
.btn(@click="clickBtn")
</tamplate>
<scrpit>
export default {
...
methods: {
clickBtn: function() {
this.$emit('clickChild', param);
}
}
}
</script>
<tmplate lang="pug">
.parent
.child(@clickChild="onClick")
</tamplate>
<scrpit>
export default {
...
methods: {
onClick: function(param) {
console.log(param);
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment