JSFiddle - React, Tailwind, and code Playground

by Md. Atiquzzaman Soikat

HTML

<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="app">
  <p>{{ message }}</p>
	<my-component v-on:hello='sayHi'></my-component>
</div>

JavaScript

Vue.component('my-component', {
  template: '<div><button v-on:click="sendHello">hello</button></div>',
	
	methods:{
		sendHello: function(){
			console.log('hello');
          this.$emit('hello','hello')
		}
	}
});
new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue.js!'
  },
	methods:{
		sayHi: function(){
			console.log('say hi')
		}
	}
})