fix(ai-pick): 避免对象展开赋值,使用 Object.keys 浅拷贝
This commit is contained in:
@@ -53,7 +53,10 @@ export class AiPickModel {
|
|||||||
this.tabs = data;
|
this.tabs = data;
|
||||||
// 写入 AppStorage:合并式更新(AppStorage 不支持原地改 Map)
|
// 写入 AppStorage:合并式更新(AppStorage 不支持原地改 Map)
|
||||||
const current: CardsDataCache = AppStorage.get<CardsDataCache>(APP_STORAGE_CACHE_KEY) ?? {};
|
const current: CardsDataCache = AppStorage.get<CardsDataCache>(APP_STORAGE_CACHE_KEY) ?? {};
|
||||||
const next: CardsDataCache = { ...current };
|
const next: CardsDataCache = {};
|
||||||
|
Object.keys(current).forEach((k: string) => {
|
||||||
|
next[k] = current[k];
|
||||||
|
});
|
||||||
next[this.cardKey] = data;
|
next[this.cardKey] = data;
|
||||||
AppStorage.setOrCreate<CardsDataCache>(APP_STORAGE_CACHE_KEY, next);
|
AppStorage.setOrCreate<CardsDataCache>(APP_STORAGE_CACHE_KEY, next);
|
||||||
this.dataError = false;
|
this.dataError = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user