14
rated 0 times
[
16]
[
2]
/ answers: 1 / hits: 19155
/ 8 Years ago, fri, december 9, 2016, 12:00:00
I use VueJs, i need to extract javascript variable to generate hidden fields.
But i need to set the name by the index of the variable.
I want to use zig-zag naming schema.
like,
<input type=text name=segment[{index}][field_name] :value={value}>
Javascript Variable:
var test_template = {
0: {
nb: 2
},
1: {
nb: 1
},
2: {
nb: 4
}
};
Foreach with Variable to Generate Hidden Fields :
<div v-for=(a,index) in test_template class=row>
<input type=hidden :name=segment[index][nb] :value=a.nb>
</div>
Here, :name is a dynamic instance for access vuejs values.
index is vuejs variable but segment is not a vuejs variable, its actually a string.
But i need this schema to generate array of inputs.
Is this possible ?
Or Any other solutions are there ?
Thanks in Advance !
More From » vue.js