How to create input name field with string-variable schema in Vue Js? : <p>I use VueJs, i need to extract javascript variable to generate hidden fields.</p>

<p>But i need to set the name by the index of the variable.</p>

<p>I want to use zig-zag naming schema.</p>

<p>like,</p>

<pre><code> &lt;input type="text" name="segment[{index}][field_name]" :value="{value}"&gt;
</code></pre>

<p><strong>Javascript Variable:</strong></p>

<pre><code>    var test_template = {
                        0: {
                            nb: 2
                        },
                        1: {
                            nb: 1
                        },
                        2: {
                            nb: 4
                        }
                    };
</code></pre>

<p><strong>Foreach with Variable to Generate Hidden Fields :</strong></p>

<pre><code>    &lt;div v-for="(a,index) in test_template" class="row"&gt;            
      &lt;input type="hidden" :name="segment[index][nb]" :value="a.nb"&gt;
   &lt;/div&gt;
</code></pre>

<p>Here, <strong>:name</strong> is a dynamic instance for access vuejs values.
<strong>index</strong> is vuejs variable but "<strong>segment</strong>" is not a vuejs variable, its actually a string.</p>

<p>But i need this schema to generate array of inputs.</p>

<p>Is this possible ?</p>

<p>Or Any other solutions are there ?</p>

<p>Thanks in Advance !</p>
