mercredi 26 septembre 2018

vuejs v-for in laravel blade

I'm unable to bind key and values when using v-for... however when I echo array it works...

<tr class="single-member" v-for='(member, key) in members' :key='key' >
        @
        <div class="field">
            <div class="control">
                <input class="input" type="text" placeholder="First name*" >
            </div>
        </div>
        <div class="field">
            <div class="control">
                <input class="input" type="text" placeholder="Last name*" >
            </div>
        </div>
        <div class="field">
            <div class="control">
                <input class="input" type="email" placeholder="Email*" >
            </div>
        </div>
        <div class="field">
            <div class="control">
                <input class="input" type="number" placeholder="Phone">
            </div>
        </div>
    </tr>

so this "key" is unable to get parsed and my members object is empty with fields "name, surname, email, phone"

NOTE that if I use @ it will work, but when I want to use @ or @ that will not work, any ideas why is this happening?

an error that I'm getting is:

app.js:6103 [Vue warn]: Property or method "key" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

(found in Root)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire