From 8450bdf0a00e71886ff752e1f9e705574a478b5e Mon Sep 17 00:00:00 2001 From: Tyh2001 <1469442737@qq.com> Date: Sat, 11 May 2024 13:11:51 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=20select?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fighting-design/option/src/option.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/fighting-design/option/src/option.vue b/packages/fighting-design/option/src/option.vue index 0d193e3805..4bc3a73737 100644 --- a/packages/fighting-design/option/src/option.vue +++ b/packages/fighting-design/option/src/option.vue @@ -47,8 +47,9 @@ return false } - if (parentInject.filter && parentInject.isFiltering) { - return (currentLabel as string).includes(parentInject.inputValue) + // 在过滤属性存在并且是正在输入中,执行过滤操作 + if (parentInject.filter && parentInject.isFiltering && currentLabel) { + return currentLabel.toString().includes(parentInject.inputValue) } return true @@ -152,7 +153,11 @@ * 初始化设置选中的值 */ const setInit = (): void => { - if (currentValue === parentInject?.modelValue) { + if (!parentInject) { + return + } + + if (currentValue === parentInject.modelValue) { parentInject && run(parentInject.setValue, currentValue, currentLabel) } }