UNPKG

lighty-admin-vite

Version:

基于 Vue3、TypeScript、Element Plus、Pinia 和 Vite 等主流技术.

19 lines (15 loc) 607 B
/** 统一处理 localStorage */ import CacheKey from "@/constants/cacheKey" import { type ThemeName } from "@/hooks/useTheme" export const getSidebarStatus = () => { return localStorage.getItem(CacheKey.SIDEBAR_STATUS) } export const setSidebarStatus = (sidebarStatus: "opened" | "closed") => { localStorage.setItem(CacheKey.SIDEBAR_STATUS, sidebarStatus) } export const getActiveThemeName = () => { return localStorage.getItem(CacheKey.ACTIVE_THEME_NAME) as ThemeName } export const setActiveThemeName = (themeName: ThemeName) => { localStorage.setItem(CacheKey.ACTIVE_THEME_NAME, themeName) }