2021-12-15 22:16:16 +08:00
|
|
|
import { useDesignStore } from '@/store/modules/designStore/designStore'
|
|
|
|
|
2021-12-18 16:36:43 +08:00
|
|
|
/**
|
|
|
|
* * 修改主题色
|
|
|
|
* @param themeName 主题名称
|
|
|
|
* @returns
|
|
|
|
*/
|
2021-12-15 22:16:16 +08:00
|
|
|
export const setHtmlTheme = (themeName?: string) => {
|
|
|
|
const e = window.document.documentElement
|
|
|
|
if (themeName) {
|
2021-12-17 11:55:42 +08:00
|
|
|
e.setAttribute('data-theme', themeName)
|
2021-12-15 22:16:16 +08:00
|
|
|
return
|
|
|
|
}
|
|
|
|
const designStore = useDesignStore()
|
2021-12-17 11:55:42 +08:00
|
|
|
e.setAttribute('data-theme', designStore.themeName)
|
|
|
|
}
|