How to pass value from selected row in for loop to vue component

Viewed 38

I am trying to pass id of currently selected row inside for loop when someone clicks on it

And pass that id to vue component

My index.blade file

@foreach($cats as $cat)
<tr>
<td class="catme" data-id="{{$cat->id}}">{{$cat-> title}}</td></tr>
@endforeach



<car-component i want to pass prop  here></car-component>


<script>
$('.catme').on('click',function(){
var a = $('.catme').attr('data-id')


})

</script>


I am unable to set that a varaiable value to that component
0 Answers
Related