title: VueJS 2: Bind v-for index to id attribute on mouseover
body: <p>I'm using a <code>v-for</code> directive on a <code>li</code> element to produce a set of images from an array. On mousing over the image, I would like to change the <code>id</code> attribute of the specific image I moused over to be <code>'drag'</code>, and I would like this image to be the only element to have the <code>id</code> of <code>'drag'</code>.</p>
  
  <p>I've tried binding to <code>:id</code> using an inline statement like you would for <code>:class</code>, but it doesn't work and simply replaces the id with <code>[object Object]</code>.  </p>
  
  <p>Here I've bound to <code>:class</code> and it behaves correctly:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var app = new Vue({
    el: '#app',
    data: {
      list: [{
        Name:'Object 1', link:'obj1.jpg'
      }, {
        Name:'Object 2', link:'obj2.jpg'
      }, {
        Name:'Object 3', link:'obj3.jpg'
      }],
      dragIndex: "",
    },
    methods: {
      drag(item,index) {
        console.log("Dragging " + item)
      },
      startDragID(index) {
        this.dragIndex = index
        console.log("Element Prepped For Drag: " + index)
      }
    }
  })</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://unpkg.com/vue"&gt;&lt;/script&gt;
  
  &lt;div id="app"&gt;
    &lt;ul&gt;
      &lt;li 
        v-for="(items,index) in list" 
        draggable="true" 
        @mouseenter="startDragID(index)" 
        @dragstart="drag(items.link,index)"
        :class="{'drag' : dragIndex == index , 'not-drag' : dragIndex != index}"
      &gt;{{items.Name}}&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>