title: How to get index of changed array under $watch in vuejs
body: <p>I am using an array of objects</p>
  
  <pre><code>({"code":"id1","color":"red","description":"eg1"})
  </code></pre>
  
  <p>where each object contains input fields.User can dynamically add and remove those objects.
  Now I want that when he enters code rest of the field should be filled automatically.
  For that I have developed an algorithm which will take the code and will give me the color and description but for that I need the POSITION of the object which is changed so that I can update the array on that index itself.
  Below is my share of code:</p>
  
  <pre><code>&lt;div v-for="(x,i) in fabric_arr"&gt;
                  &lt;!--&lt;pre&gt;{{x}}&lt;/pre&gt;--&gt;
                  &lt;div class="row"&gt;
                    &lt;div class="col-md-4"&gt;
                      &lt;span&gt;
                        &lt;input type=”text” list="idOfDatalist" class="form-control  border-input" placeholder="Fabric Code" v-model="x._id"&gt;
                          &lt;datalist id="idOfDatalist"&gt;
                             &lt;option v-for="y in all_fabrics"&gt;{{y._id}}&lt;/option&gt;
                          &lt;/datalist&gt;
                      &lt;/span&gt;
                    &lt;/div&gt;
                    &lt;div class="col-md-4"&gt;
                      &lt;span&gt;
                        &lt;input type=”text”  class="form-control border-input"  placeholder="Fabric Color" v-model="x.color"&gt;&lt;/span&gt;
                    &lt;/div&gt;
                    &lt;div class="col-md-4"&gt;
                   &lt;span&gt;
                        &lt;input type=”text” class="form-control border-input" placeholder="Fabric Description" v-model="x.description"&gt;&lt;/span&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
  </code></pre>
  
  <p>And my controller:</p>
  
  <pre><code> watch: {
        fabric_arr: {
          handler : function (val) {
            console.log("val");
            console.log(val);
            //val.color="red always";
            this.fabric_arr[0].color="fghjkl"
          },
          deep: true
        }
      }
  </code></pre>