[英]How can I update a nested array with ionic4 storage
使用
openSavedForm() {
this.storage.get('test').then((val) => {
this.auditResults = JSON.parse(val);
this.audit = this.auditResults
this.auditOne = this.auditResults.siteVehicle;
console.log('pull all', this.audit);
});
}
我可以在 sqlite 中查看我的鍵值對存儲項。 這是 console.log 的照片
是否可以只更新 siteVehicle 數組
async saveFormUpdates() {
this.newAudit =this.auditOne;
await this.storage.set( 'test', JSON.stringify(this.newAudit));
console.log ("storage", this.newAudit);
}
不刪除所有其他 arrays?
我的異步 saveFormUpdates() 是錯誤的。 結果只是保存 this.audit 而不是 this.auditOne 完成了所有操作,而我沒有進一步的輸入。
async saveFormUpdates() {
this.newAudit = this.audit;
await this.storage.set( 'test', JSON.stringify(this.newAudit));
console.log ("storage", this.newAudit);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.