JSFiddle - React, Tailwind, and code Playground
by Mladen Mihajlovic
HTML
<html>
<head>
</head>
<body>
<div id="app">
{{txt}}
<pare @smth="s"></pare>
</div>
</body>
</html>
JavaScript
Vue.component('comp', {
template: `
<div>
<button @click="doSomething">click</button>
</div>
`,
methods: {
doSomething() {
this.$emit('smt');
}
}
})
Vue.component('pare', {
template: `
<div>
<comp></comp>
</div>
`,
data() {
return {
}
}
})
new Vue({
el: '#app',
data: {
txt: ''
},
methods: {
s() {
this.txt = 'received'
}
}
})