0

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>

2
  • could you show the vue instance? Commented Aug 22, 2020 at 13:08
  • You're creating a Vue instance for every <div id='app'>. There should only be one element with an id app that you mount to. Commented Aug 23, 2020 at 2:54

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

1 Comment

There is a answer!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.