diff --git a/components/vc-util/Dom/css.ts b/components/vc-util/Dom/css.ts index 512a2609f..7cb597dfe 100644 --- a/components/vc-util/Dom/css.ts +++ b/components/vc-util/Dom/css.ts @@ -121,7 +121,13 @@ export function styleToString(style: CSSStyleDeclaration) { } export function styleObjectToString(style: Record) { - return Object.keys(style) - .map(name => `${name}: ${style[name]};`) - .join(''); + return Object.keys(style).reduce((acc, name) => { + const styleValue = style[name]; + if (typeof styleValue === 'undefined' || styleValue === null) { + return acc; + } + + acc += `${name}: ${style[name]};`; + return acc; + }, ''); }