[Vuejs]-Bug when using v-model causing the input field to be deselected after each keystroke

0👍

Problem is that in nested v-for, you are using value (item) as a v-for key.

This works:

<template>
  <div class="hello">
    <table class="input-table">
      <tr>
        <th style="padding-left: 20px; padding-right: 20px;">Site</th>
        <th v-for="(head, key) in listArr[0]" v-bind:key="head">{{ key }}</th>
      </tr>
      <tr v-for="(thing , index) in listArr" v-bind:key="index">
        <td>{{index + 1}}</td>
        <td v-for="(item , key) in thing" v-bind:key="key"> <-- HERE!
          <input v-model="thing[key]" class="input-enter" type="text">
        </td>
      </tr>
    </table>
  </div>
</template>

Leave a comment