fix: 修改类型

This commit is contained in:
mtruning
2022-01-23 19:22:54 +08:00
parent 0033b42008
commit d7965c5857
3 changed files with 12 additions and 7 deletions
+3 -4
View File
@@ -82,13 +82,12 @@ export const screenfullFn = (isFullscreen?: boolean, isEnabled?: boolean) => {
* @param key 键名
* @param value 键值
*/
export const setDomAttribute = <T extends keyof CSSStyleDeclaration>(
export const setDomAttribute = <K extends keyof CSSStyleDeclaration, V extends CSSStyleDeclaration[K]>(
HTMLElement: HTMLElement,
key: T,
value: any
key: K,
value: V
) => {
if (HTMLElement) {
// @ts-ignore
HTMLElement.style[key] = value
}
}