Created
February 4, 2020 07:46
-
-
Save ChoWonmin/7f8b0828fa9b51f34a1b0dbc4d56d1a0 to your computer and use it in GitHub Desktop.
vue emit
This file contains 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
<tmplate lang="pug"> | |
.child | |
.btn(@click="clickBtn") | |
</tamplate> | |
<scrpit> | |
export default { | |
... | |
methods: { | |
clickBtn: function() { | |
this.$emit('clickChild', param); | |
} | |
} | |
} | |
</script> |
This file contains 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
<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