goview_vue/src/utils/style.ts

17 lines
420 B
TypeScript
Raw Normal View History

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) {
e.setAttribute('data-theme', themeName)
2021-12-15 22:16:16 +08:00
return
}
const designStore = useDesignStore()
e.setAttribute('data-theme', designStore.themeName)
}