go-view/src/utils/style.ts
2021-12-18 16:36:43 +08:00

17 lines
420 B
TypeScript

import { useDesignStore } from '@/store/modules/designStore/designStore'
/**
* * 修改主题色
* @param themeName 主题名称
* @returns
*/
export const setHtmlTheme = (themeName?: string) => {
const e = window.document.documentElement
if (themeName) {
e.setAttribute('data-theme', themeName)
return
}
const designStore = useDesignStore()
e.setAttribute('data-theme', designStore.themeName)
}