1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-09 18:30:23 +08:00
Files
paper-manager/frontend/vben/src/logics/theme/util.ts
2023-03-10 17:18:32 +08:00

12 lines
418 B
TypeScript

const docEle = document.documentElement
export function toggleClass(flag: boolean, clsName: string, target?: HTMLElement) {
const targetEl = target || document.body
let { className } = targetEl
className = className.replace(clsName, '')
targetEl.className = flag ? `${className} ${clsName} ` : className
}
export function setCssVar(prop: string, val: any, dom = docEle) {
dom.style.setProperty(prop, val)
}