From bf29e0e52a5e0924f864dc241ca4ce5867d046bc Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Thu, 1 Jun 2023 09:24:37 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?utils/cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useTheme.ts | 2 +- src/store/modules/app.ts | 2 +- src/utils/cache/{localStorage.ts => local-storage.ts} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/utils/cache/{localStorage.ts => local-storage.ts} (98%) diff --git a/src/hooks/useTheme.ts b/src/hooks/useTheme.ts index 6ab392e..0ca28a2 100644 --- a/src/hooks/useTheme.ts +++ b/src/hooks/useTheme.ts @@ -1,5 +1,5 @@ import { ref, watchEffect } from "vue" -import { getActiveThemeName, setActiveThemeName } from "@/utils/cache/localStorage" +import { getActiveThemeName, setActiveThemeName } from "@/utils/cache/local-storage" const DEFAULT_THEME_NAME = "normal" type DefaultThemeName = typeof DEFAULT_THEME_NAME diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index 06e0d0a..d9db89c 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -1,6 +1,6 @@ import { reactive, ref, watch } from "vue" import { defineStore } from "pinia" -import { getSidebarStatus, setSidebarStatus } from "@/utils/cache/localStorage" +import { getSidebarStatus, setSidebarStatus } from "@/utils/cache/local-storage" import { DeviceEnum, SIDEBAR_OPENED, SIDEBAR_CLOSED } from "@/constants/app-key" interface Sidebar { diff --git a/src/utils/cache/localStorage.ts b/src/utils/cache/local-storage.ts similarity index 98% rename from src/utils/cache/localStorage.ts rename to src/utils/cache/local-storage.ts index 7b601ef..639b769 100644 --- a/src/utils/cache/localStorage.ts +++ b/src/utils/cache/local-storage.ts @@ -12,7 +12,7 @@ export const setSidebarStatus = (sidebarStatus: SidebarOpened | SidebarClosed) = } export const getActiveThemeName = () => { - return localStorage.getItem(CacheKey.ACTIVE_THEME_NAME) as ThemeName + return localStorage.getItem(CacheKey.ACTIVE_THEME_NAME) as ThemeName | null } export const setActiveThemeName = (themeName: ThemeName) => { localStorage.setItem(CacheKey.ACTIVE_THEME_NAME, themeName)