[Vuejs]-VueJs use attribute value to get array value

0👍

There is no way you can access the name attribute in that way. To further elabourate my comment, a way will be to declare an array containing all the values for the name attribute, and then iterating through them using v-for. This gives you access to the dynamic name attribute. A proof-of-concept code:

JS:

data: function() {
    return {
        names: ['name1', 'name2', 'name3']
    };
}

Template:

<v-container v-for="(name, i) in names" :key="i">
    <v-row>
        <v-col cols="12">
            <v-text-field v-model="label" :name="name" :error-messages="errors[name]" label="Label" @change="resetFormInputValidation" required></v-text-field>
        </v-col>
    </v-row>
    <!-- Other markup -->
</v-container>

Leave a comment