mirror of
https://github.com/vbenjs/vben-admin-thin-next.git
synced 2025-01-24 10:33:47 +08:00
fix(theme): css filter breaking fixed position (#125)
Add css filters to `html` instead of `body`
This commit is contained in:
parent
d023fb1374
commit
c911af4aca
@ -15,11 +15,11 @@ export function setCssVar(prop: string, val: any, dom = document.documentElement
|
|||||||
dom.style.setProperty(prop, val);
|
dom.style.setProperty(prop, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleClass(flag: boolean, clsName: string) {
|
function toggleClass(flag: boolean, clsName: string, target?: HTMLElement) {
|
||||||
const body = document.body;
|
const targetEl = target || document.body;
|
||||||
let { className } = body;
|
let { className } = targetEl;
|
||||||
className = className.replace(clsName, '');
|
className = className.replace(clsName, '');
|
||||||
document.body.className = flag ? `${className} ${clsName} ` : className;
|
targetEl.className = flag ? `${className} ${clsName} ` : className;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,7 +27,7 @@ function toggleClass(flag: boolean, clsName: string) {
|
|||||||
* @param gray
|
* @param gray
|
||||||
*/
|
*/
|
||||||
export const updateColorWeak = (colorWeak: boolean) => {
|
export const updateColorWeak = (colorWeak: boolean) => {
|
||||||
toggleClass(colorWeak, 'color-weak');
|
toggleClass(colorWeak, 'color-weak', document.documentElement);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +35,7 @@ export const updateColorWeak = (colorWeak: boolean) => {
|
|||||||
* @param gray
|
* @param gray
|
||||||
*/
|
*/
|
||||||
export const updateGrayMode = (gray: boolean) => {
|
export const updateGrayMode = (gray: boolean) => {
|
||||||
toggleClass(gray, 'gray-mode');
|
toggleClass(gray, 'gray-mode', document.documentElement);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user