refactor: ♻️ 优化主题和主题色集中监听,避免多处初始化

This commit is contained in:
hxr
2024-03-03 23:04:07 +08:00
parent 8456f1f26d
commit 17c29ee971
4 changed files with 93 additions and 87 deletions

View File

@@ -30,6 +30,8 @@ export function removeClass(ele: HTMLElement, cls: string) {
}
/**
* 判断是否是外部链接
*
* @param {string} path
* @returns {Boolean}
*/
@@ -37,3 +39,13 @@ export function isExternal(path: string) {
const isExternal = /^(https?:|http?:|mailto:|tel:)/.test(path);
return isExternal;
}
/**
* 设置Style属性
*
* @param propName
* @param value
*/
export function setStyleProperty(propName: string, value: string) {
document.documentElement.style.setProperty(propName, value);
}