2022-09-09 18:03:47 +08:00

19 lines
501 B
TypeScript

import log from "./log";
/**
* 添加全局style
* @param {string} css CSS规则
*/
export default function addStyle(css: string) {
let wh_gStyle = document.querySelector('style#wh-trans-gStyle');
if (wh_gStyle) {
wh_gStyle.innerHTML += css;
} else {
wh_gStyle = document.createElement("style");
wh_gStyle.id = 'wh-trans-gStyle';
wh_gStyle.innerHTML = css;
document.head.append(wh_gStyle);
}
log.info('CSS规则已添加', wh_gStyle);
}