|
|
@@ -1,10 +1,13 @@
|
|
|
import config from '@/config/defaultSetting'
|
|
|
import colorUtil from '@/utils/color'
|
|
|
-import type { themeStyle } from '@/types/themeStyle'
|
|
|
+import { themeStyleList } from '@/utils/constants'
|
|
|
|
|
|
export const useThemeStore = defineStore('theme', () => {
|
|
|
const themeColor = useStorage('themeColor', config.themeColor)
|
|
|
- const themeStyle = useStorage('themeStyle', config.themeStyle)
|
|
|
+ const themeStyleName = useStorage('themeStyle', config.themeStyle)
|
|
|
+ const themeStyle = computed(
|
|
|
+ () => themeStyleList.find(item => item.name === themeStyleName.value) || themeStyleList[0]
|
|
|
+ )
|
|
|
|
|
|
const setThemeColor = (color: string) => {
|
|
|
themeColor.value = color
|
|
|
@@ -21,8 +24,8 @@ export const useThemeStore = defineStore('theme', () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const setThemeStyle = (style: themeStyle) => {
|
|
|
- themeStyle.value = style
|
|
|
+ const setThemeStyle = (style: string) => {
|
|
|
+ themeStyleName.value = style
|
|
|
initThemeStyle()
|
|
|
}
|
|
|
const initThemeStyle = () => {
|