From 917feec5d8f4512b26d3bcac7fba6465342e8371 Mon Sep 17 00:00:00 2001 From: ChenZhaoYu <790348264@qq.com> Date: Thu, 23 Mar 2023 14:50:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=87=8D=E7=BD=AE=E6=97=B6=E5=BA=94?= =?UTF-8?q?=E8=AF=A5=E7=A7=BB=E9=99=A4=E6=9C=AC=E5=9C=B0=E5=82=A8=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/settings/helper.ts | 4 ++++ src/store/modules/settings/index.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/store/modules/settings/helper.ts b/src/store/modules/settings/helper.ts index 98e932b..a552f7b 100644 --- a/src/store/modules/settings/helper.ts +++ b/src/store/modules/settings/helper.ts @@ -21,3 +21,7 @@ export function getLocalState(): SettingsState { export function setLocalState(setting: SettingsState): void { ss.set(LOCAL_NAME, setting) } + +export function removeLocalState() { + ss.remove(LOCAL_NAME) +} diff --git a/src/store/modules/settings/index.ts b/src/store/modules/settings/index.ts index 7f7931b..0dbb796 100644 --- a/src/store/modules/settings/index.ts +++ b/src/store/modules/settings/index.ts @@ -1,6 +1,6 @@ import { defineStore } from 'pinia' import type { SettingsState } from './helper' -import { defaultSetting, getLocalState, setLocalState } from './helper' +import { defaultSetting, getLocalState, removeLocalState, setLocalState } from './helper' export const useSettingStore = defineStore('setting-store', { state: (): SettingsState => getLocalState(), @@ -12,7 +12,7 @@ export const useSettingStore = defineStore('setting-store', { resetSetting() { this.$state = defaultSetting() - this.recordState() + removeLocalState() }, recordState() {