我正在观看数组,如果满足某些条件,我想禁用/修改其他元素但到目前为止没有运气,因为变量already_answered不是被动的。
<input :disabled="already_answered" type="text" />
data: function() {
return {
already_answered: false,
somearr: [],
};
},
watch: {
somearr() {
for (var i = 0; i < this.somearr.length; i++) {
if (this.somearr[i]["id"] == 5) {
this.already_answered = true
break;
}
}
},
},