修复同步更新值的错误

This commit is contained in:
2023-11-03 11:36:46 +08:00
parent 197145ee0f
commit b13517010e
2 changed files with 7 additions and 1 deletions

View File

@@ -155,6 +155,8 @@
if (this.listItem.length == 0) {
this.onAddItem();
}
this.updateValue(this.listItem);
},
onAddItem() {
@@ -167,6 +169,8 @@
emptyItem.uid = ua.randdomString();
this.listItem.push(emptyItem);
this.updateValue(this.listItem);
},
onItemChange(item, index, itemField, event) {
this.listItem[index][itemField.key] = event.target.value;
@@ -184,6 +188,8 @@
} else {
this.listItem.splice(index, 1);
}
this.updateValue(this.listItem);
},
updateValue(newValue) {
this.value = JSON.stringify(newValue);