fix: 重置时应该移除本地储存
This commit is contained in:
parent
c52195cef8
commit
917feec5d8
|
@ -21,3 +21,7 @@ export function getLocalState(): SettingsState {
|
||||||
export function setLocalState(setting: SettingsState): void {
|
export function setLocalState(setting: SettingsState): void {
|
||||||
ss.set(LOCAL_NAME, setting)
|
ss.set(LOCAL_NAME, setting)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function removeLocalState() {
|
||||||
|
ss.remove(LOCAL_NAME)
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import type { SettingsState } from './helper'
|
import type { SettingsState } from './helper'
|
||||||
import { defaultSetting, getLocalState, setLocalState } from './helper'
|
import { defaultSetting, getLocalState, removeLocalState, setLocalState } from './helper'
|
||||||
|
|
||||||
export const useSettingStore = defineStore('setting-store', {
|
export const useSettingStore = defineStore('setting-store', {
|
||||||
state: (): SettingsState => getLocalState(),
|
state: (): SettingsState => getLocalState(),
|
||||||
|
@ -12,7 +12,7 @@ export const useSettingStore = defineStore('setting-store', {
|
||||||
|
|
||||||
resetSetting() {
|
resetSetting() {
|
||||||
this.$state = defaultSetting()
|
this.$state = defaultSetting()
|
||||||
this.recordState()
|
removeLocalState()
|
||||||
},
|
},
|
||||||
|
|
||||||
recordState() {
|
recordState() {
|
||||||
|
|
Loading…
Reference in New Issue