jeudi 27 juillet 2017

Laravel 5.4 + vue2 click Event Handling not working

I have problem with Event Handling in vue2 with Laravel 5.4 - nothing happen when i use click event on the button. No error or anything else.

My html (in fact its header.blade.php):

<div id="example">
  <button v-on:click="exclick">Super btn</button>
</div>

My js (app.js in resources/assets folder)

require('./bootstrap');

new Vue({
  el: '#example',
  methods: {
    exclick: function (event) {
      alert("Log 1");
      if (event) {
        alert("Log 2");
      }
    }
  }
});

const app = new Vue({
    el: '#app'
});

JS compiled by gulp

Please help!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire