Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 917feec

Browse files
committed
fix: 重置时应该移除本地储存
1 parent c52195c commit 917feec

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/store/modules/settings/helper.ts

+4
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ export function getLocalState(): SettingsState {
2121
export function setLocalState(setting: SettingsState): void {
2222
ss.set(LOCAL_NAME, setting)
2323
}
24+
25+
export function removeLocalState() {
26+
ss.remove(LOCAL_NAME)
27+
}

src/store/modules/settings/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineStore } from 'pinia'
22
import type { SettingsState } from './helper'
3-
import { defaultSetting, getLocalState, setLocalState } from './helper'
3+
import { defaultSetting, getLocalState, removeLocalState, setLocalState } from './helper'
44

55
export const useSettingStore = defineStore('setting-store', {
66
state: (): SettingsState => getLocalState(),
@@ -12,7 +12,7 @@ export const useSettingStore = defineStore('setting-store', {
1212

1313
resetSetting() {
1414
this.$state = defaultSetting()
15-
this.recordState()
15+
removeLocalState()
1616
},
1717

1818
recordState() {

0 commit comments

Comments
 (0)