简体   繁体   中英

Laravel + Vue load component inside @foreach on blade

Good night

I have the next @foreach in my home.blade.php

 @foreach($User as $User1) <tr> <td>{{$User1->name}}</td> <td>{{$User1->email}}</td> <td>{{$User1->pais}}</td> <td>{{$User1->status}}</td> <td> <div id='app'> <calculadora-component></calculadora-component> </div> </td> </tr> @endforeach

But the calculadora-component not works with the @foreach, how can I do it?

And this is my vue component for the moment,

 <template> <div id="app"> <select v-on:change="onSelectOption($event)" class="form-control" name="status"> <option value="" disabled selected hidden>Seleccionar una Opción</option> <option value="Activo" selected>Activo</option> <option value="Inactivo">Inactivo</option> </select> </div> </template>

You have to wrap that foreach loop into a div with the app id like this:

<div id='app'>
@foreach($User as $User1)
        <tr>
    <td>{{$User1->name}}</td>
        <td>{{$User1->email}}</td>
        <td>{{$User1->pais}}</td>
            <td>{{$User1->status}}</td>
    <td>
<div>
    <calculadora-component></calculadora-component>
</div>
    </td>
        </tr>
@endforeach
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM