From 6ce3f8f2d6c96cf5fb5b24c592f2b05f0a33a977 Mon Sep 17 00:00:00 2001 From: LockingReal <1191515088@qq.com> Date: Sat, 22 Jul 2023 22:42:31 +0800 Subject: [PATCH] perf(server-renderer):normalizeValue function prioritizes the judgment of values equal to 0, thereby improving performance --- packages/server-renderer/src/modules/style.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server-renderer/src/modules/style.ts b/packages/server-renderer/src/modules/style.ts index 23c8e0d4237..2cb60a223b1 100644 --- a/packages/server-renderer/src/modules/style.ts +++ b/packages/server-renderer/src/modules/style.ts @@ -21,9 +21,9 @@ export function genStyle(style: Object): string { function normalizeValue(key: string, value: any): string { if ( + value === 0 || typeof value === 'string' || - (typeof value === 'number' && noUnitNumericStyleProps[key]) || - value === 0 + (typeof value === 'number' && noUnitNumericStyleProps[key]) ) { return `${key}:${value};` } else {