JSFiddle - React, Tailwind, and code Playground

by skirtle

HTML

<script src="https://unpkg.com/[email protected]/dist/vue.global.js"></script>
<div id="app">
  <div class="container">
    <div class="row">
      <div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
        <button v-test:click="clicked">Click me</button>
      </div>
    </div>
  </div>
</div>

JavaScript

Vue.createApp({
  name: 'App',
  components: {
  },
  directives: {
    test: {
      beforeMount(el, binding) {
        const type = binding.arg;
        const fn = binding.value;
        el.addEventListener(type, fn)
      }
    }
  },
  methods: {
    clicked() {
      alert('text');
    }
  }
}).mount('#app')