Guest User

Untitled

a guest
Mar 17th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Vue.component('child-component', {
  2. template: '<div>Child</div>',
  3. mounted() {
  4. this.$emit('test');
  5. },
  6. methods: {
  7. onClick: function() {
  8. this.$emit('child-click-on');
  9. }
  10. }
  11. });
  12.  
  13. var vm = new Vue({
  14. el: '#app',
  15. created: function () {
  16. this.$on('test', function () {
  17. console.log('test-on');
  18. });
  19. this.$on('child-click', function () {
  20. console.log('child-click-on');
  21. });
  22. }
  23. });
Add Comment
Please, Sign In to add comment