[Vuejs]-I am trying to pass user id from my blade template to Vue for Axios post request to the server

0👍

The this.$el is going to refer to the element. When using PHP to iterate through records. You should pass the id through the click event handler. Thanks to Wilk Randall on laracast for the help.

methods: {
    whichId (postId) {
          console.log(postId);
    }
}
<td><button v-on:click="whichId({{ $post->id }})"<img src="/images/heart.svg" width="30"></button></td>

Leave a comment