From 0abe5301a11679a42b179b76bf472ef25cacbc75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?w=C5=AB=20y=C4=81ng?= Date: Sat, 9 Nov 2024 22:21:51 +0800 Subject: [PATCH] feat(cascader): click item to close panel when trigger is hover --- src/cascader/core/effect.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cascader/core/effect.ts b/src/cascader/core/effect.ts index c71ad6ef69..7f30f6ef05 100644 --- a/src/cascader/core/effect.ts +++ b/src/cascader/core/effect.ts @@ -45,7 +45,8 @@ export function expendClickEffect( // 非受控状态下更新状态 setValue(valueType === 'single' ? value : node.getPath().map((item) => item.value), 'check', node.getModel()); - if (!checkStrictly) { + // 当 trigger 为 hover 时 ,点击节点一定是关闭 panel 的操作 + if (!checkStrictly || propsTrigger === 'hover') { setVisible(false, {}); } }