feat: 完成主题切换,语言切换的本地存储

This commit is contained in:
MTrun
2021-12-17 11:55:42 +08:00
parent 7f67f482da
commit 557ddd6ee5
27 changed files with 446 additions and 102 deletions
+3 -4
View File
@@ -1,12 +1,11 @@
import { useDesignStore } from '@/store/modules/designStore/designStore'
import { theme as themeEnum } from '@/settings/designSetting'
export const setHtmlTheme = (themeName?: string) => {
const e = window.document.documentElement
if (themeName) {
e.setAttribute("data-theme", themeName);
e.setAttribute('data-theme', themeName)
return
}
const designStore = useDesignStore()
e.setAttribute("data-theme", designStore.getDarkTheme ? themeEnum.darkThemeName : themeEnum.lightThemeName);
}
e.setAttribute('data-theme', designStore.themeName)
}