JSFiddle - React, Tailwind, and code Playground

by darkylmnx

HTML

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js"></script>
<div id="app">
  <h1>Je vais vous montrer la vie</h1>
  <button @click="open">afficher la modal</button>
</div>

Vue

const Child = {
	props: ['id'],
  template: `<p> je suis la modal {{ id }} </p>`,
  mounted() {
  	this.$emit('toto', 'une valeur')
  }
}

Vue.use(window['vue-js-modal'].default);

new Vue({
  el: '#app',
  methods: {
    open() {
      this.$modal.show({
      	render(create) {
        	return create(Child, {
            props: { id: 4 },
						on: {
							toto(event) {
								console.log('je suis levent toto', event)
							}
						}
					})
        }
      })
    }
  }
})