梁鑫辉 2020-01-15 10:57:59 +08:00 committed by tangjinzhou
parent 0244d215ad
commit 0dbea62fdf
1 changed files with 8 additions and 2 deletions

View File

@ -106,11 +106,17 @@ Table with editable rows.
},
save(key) {
const newData = [...this.data];
const newCacheData = [...this.cacheData];
const target = newData.filter(item => key === item.key)[0];
if (target) {
const targetCache = newCacheData.filter(item => key === item.key)[0];
if (target && targetCache) {
delete target.editable;
this.data = newData;
this.cacheData = newData.map(item => ({ ...item }));
Object.assign(
targetCache,
target
);
this.cacheData = newCacheData;
}
},
cancel(key) {