mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-01-03 06:08:12 +00:00
12 lines
424 B
Vue
12 lines
424 B
Vue
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);
|
|
}
|