fix(utils): type error (#7939)

This commit is contained in:
三咲智子 2022-05-30 11:51:50 +08:00 committed by GitHub
parent af732b124b
commit 7e0f6d71a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -51,7 +51,5 @@
"packages/components/tree/",
"packages/components/virtual-list/",
"packages/components/visual-hidden/",
"packages/directives/",
"packages/utils/dom/",
"packages/utils/vue/"
"packages/directives/"
]

View File

@ -35,12 +35,12 @@ export const getStyle = (
let key = camelize(styleName)
if (key === 'float') key = 'cssFloat'
try {
const style = element.style[styleName]
const style = (element.style as any)[key]
if (style) return style
const computed = document.defaultView?.getComputedStyle(element, '')
return computed ? computed[styleName] : ''
const computed: any = document.defaultView?.getComputedStyle(element, '')
return computed ? computed[key] : ''
} catch {
return element.style[styleName]
return (element.style as any)[key]
}
}
@ -56,8 +56,8 @@ export const setStyle = (
setStyle(element, prop, value)
)
} else {
const key = camelize(styleName)
element.style[key] = value
const key: any = camelize(styleName)
element.style[key] = value as any
}
}