From bcff2cf9253145d0dd4b36daed70a12ecbd2ff54 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期五, 26 七月 2024 10:56:57 +0800 Subject: [PATCH] 选择宽度自适应 --- src/utils/util.ts | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/utils/util.ts b/src/utils/util.ts index d35d575..6410b2d 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -704,6 +704,7 @@ }; export function getTextWidth(text: string, option: GetTextWidthOption) { + if (!text) return 0; const { size = '14px', family = 'Microsoft YaHei' } = option; const spanEle = document.createElement('span'); document.body.appendChild(spanEle); -- Gitblit v1.9.3