我想检查我的表单中是否至少有一个字段被更改。如果这种情况为真,disableButton
则将设置为true,如果表单中没有更改,则设置为false 。以下是我当前的代码:
// this.hold is an array that temporary holds the previous values of
// the form for comparison of the changes in form
if(this.data.process == 'update') {
for(const f in form.value){
if (form.value[f] == this.hold[f])
this.disableButton = true;
else
this.disableButton = false;
}
}
问题是,该按钮仅在更改所有字段时才禁用。我应该在条件或 for 循环中添加什么?