From d7472b8a2e480299888ffeac6ac95466b27afa0f Mon Sep 17 00:00:00 2001 From: bowen <54492610+jiaowoxiaobala@users.noreply.github.com> Date: Mon, 20 Nov 2023 16:56:28 +0800 Subject: [PATCH] fix(VFormDesign): findIndex === -1 (#3305) --- .../VFormDesign/config/componentPropsConfig.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/views/form-design/components/VFormDesign/config/componentPropsConfig.ts b/src/views/form-design/components/VFormDesign/config/componentPropsConfig.ts index 0d57bc80..802652ba 100644 --- a/src/views/form-design/components/VFormDesign/config/componentPropsConfig.ts +++ b/src/views/form-design/components/VFormDesign/config/componentPropsConfig.ts @@ -1122,13 +1122,11 @@ export const baseComponentAttrs: IBaseComponentProps = componentAttrs; //在所有的选项中查找需要配置项 const findCompoentProps = (props, name) => { - const idx = props.findIndex((value: BaseFormAttrs, _index) => { - return value.name == name; + const idx = props.findIndex((value: BaseFormAttrs) => { + return value.name === name; }); - if (idx) { - if (props[idx].componentProps) { - return props[idx].componentProps; - } + if (props[idx] && props[idx].componentProps) { + return props[idx].componentProps; } };