只是碰到我之前没有遇到的这个错误:"你将v-model直接绑定到v-for迭代别名.这将无法修改v-for源数组,因为写入别名就像修改一个函数局部变量.考虑使用对象数组并在对象属性上使用v-model." 我有点困惑,因为我似乎没有做错任何事.与之前使用的其他v-for循环的唯一区别是,这个有点简单,因为它只是循环遍历字符串数组而不是对象:
<tr v-for="(run, index) in this.settings.runs">
<td>
<text-field :name="'run'+index" v-model="run"/>
</td>
<td>
<button @click.prevent="removeRun(index)">X</button>
</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
错误消息似乎表明我需要实际上使事情变得更复杂,并使用对象而不是简单的字符串,这对我来说似乎不合适.我错过了什么吗?
vue.js ×1