Skip to content

Commit d0c2f3b

Browse files
committed
🐛 修复eslint配置无法重置的问题
1 parent 6ff24e3 commit d0c2f3b

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/pkg/config/config.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,13 @@ export class SystemConfig {
6868
}
6969

7070
public set(key: string, val: any) {
71-
this.cache.set(key, val);
72-
this.storage.set(key, val);
71+
if (val === undefined) {
72+
this.cache.delete(key);
73+
this.storage.remove(key);
74+
} else {
75+
this.cache.set(key, val);
76+
this.storage.set(key, val);
77+
}
7378
// 发送消息通知更新
7479
this.mq.publish(SystamConfigChange, {
7580
key,
@@ -188,7 +193,7 @@ export class SystemConfig {
188193

189194
setEslintConfig(v: string) {
190195
if (v === "") {
191-
this.set("eslint_config", v);
196+
this.set("eslint_config", undefined);
192197
Message.success("ESLint规则已重置");
193198
return;
194199
}

0 commit comments

Comments
 (0)