From 51fde32ec405d3f09d9341dae7ac5d63fe5d10db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Wed, 26 Feb 2025 14:45:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE=E5=85=BC?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/custom-module/data-rendering/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/custom-module/data-rendering/index.vue b/src/components/common/custom-module/data-rendering/index.vue index e9677e73..d620e7fb 100644 --- a/src/components/common/custom-module/data-rendering/index.vue +++ b/src/components/common/custom-module/data-rendering/index.vue @@ -104,7 +104,7 @@ const updateLocation = (targetItem: HTMLElement, data_follow: { spacing: number const locationValue = parseFloat(locationValueStr); if (isNaN(locationValue) || scale <= 0 || (isX ? targetItem.clientWidth < 0 : targetItem.clientHeight < 0)) return 0; - return ((locationValue + data_follow.spacing) * scale) + (isX ? targetItem.clientWidth : targetItem.clientHeight); + return ((locationValue + (data_follow?.spacing || 0)) * scale) + (isX ? targetItem.clientWidth : targetItem.clientHeight); } catch (error) { return 0; } @@ -187,7 +187,7 @@ watch(() => props.customList, async (val) => { const percentage_count = (val: number, data_follow: { id: string, type: string }, type: string, is_auto?: string, max_size?: number) => { // 检查类型是否为'left'或'top',如果是,则根据跟随数据计算样式 if (['left', 'top'].includes(type)) { - const { id = '', type: follow_type = 'left' } = data_follow; + const { id = '', type: follow_type = 'left' } = data_follow || { id: '', type: 'left' }; // 如果id不为空且follow_type与type匹配,则返回原始值的字符串表示 if (id !== '' && follow_type === type) { return `${val}px`;