types: improve typing (#309)
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import { isString } from '@vue/shared'
|
||||
|
||||
export function patchStyle(el: any, prev: any, next: any) {
|
||||
const { style } = el
|
||||
type Style = string | Partial<CSSStyleDeclaration> | null
|
||||
|
||||
export function patchStyle(el: Element, prev: Style, next: Style) {
|
||||
const style = (el as HTMLElement).style
|
||||
if (!next) {
|
||||
el.removeAttribute('style')
|
||||
} else if (isString(next)) {
|
||||
style.cssText = next
|
||||
} else {
|
||||
for (const key in next) {
|
||||
style[key] = next[key]
|
||||
style[key] = next[key] as string
|
||||
}
|
||||
if (prev && !isString(prev)) {
|
||||
for (const key in prev) {
|
||||
|
||||
Reference in New Issue
Block a user