报错信息:
You are binding v-model directly to a v-for iteration alias. This will not be able to modify the v-for source array because writing to the alias is like modifying a function local variable. Consider using an array of objects and use v-model on an object

解释:
您正在将v-model直接绑定到v-for迭代别名。这将无法修改v-for源数组,因为写入别名类似于修改函数局部变量。考虑使用对象数组,而在对象属性上使用v-model

适用于此类结构:


{
品牌: "米加亚", 
颜色: "黑色系", 
CPU 核数: "八核", 
…
}

解决方法:

<div v-for="(value, name ,index) in object" :key="index">
  <input v-model="value" />
  <input v-model="object[name]" />
</div>

ClingClang
11 声望0 粉丝