perf: improve VNode creation performance with compiler hints (#3334)

This commit is contained in:
HcySunYang
2021-06-23 07:15:20 +08:00
committed by Evan You
parent 31abdc8ada
commit ceff89905b
42 changed files with 1130 additions and 685 deletions

View File

@@ -76,3 +76,15 @@ export function normalizeClass(value: unknown): string {
}
return res.trim()
}
export function normalizeProps(props: Record<string, any> | null) {
if (!props) return null
let { class: klass, style } = props
if (klass && !isString(klass)) {
props.class = normalizeClass(klass)
}
if (style) {
props.style = normalizeStyle(style)
}
return props
}