JSFiddle - React, Tailwind, and code Playground

by Steve

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.min.js "></script>
<template id="child-template">
  child here
  <slot name="form">
  </slot>
</template>

<div id="events-example">
  <child>
    <div slot="form">
      <input :value="msg">
      <button v-on:click="notify">Dispatch Event</button>
    </div>
  </child>
</div>

JavaScript

// register child, which dispatches an event with
// the current message
Vue.component('child', {
  template: '#child-template'
})

var parent = new Vue({
  el: '#events-example',
  data: function () {
    return { msg: 'hello' }
  },
  methods: {
    notify: function () {
      alert('ok');
    }
  }
})