Skip to content

Commit

Permalink
fix(cascader): fix filterable parent click bug (#3333)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored Sep 24, 2024
1 parent 672f02c commit 0956ff0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/cascader/core/effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,25 @@ export function expendClickEffect(
cascaderContext: CascaderContextType,
) {
const {
checkStrictly, multiple, treeStore, setVisible, setValue, setTreeNodes, setExpend, value, max, valueType,
checkStrictly,
multiple,
treeStore,
setVisible,
setValue,
setTreeNodes,
setExpend,
value,
max,
valueType,
filterable,
inputVal,
} = cascaderContext;

const isDisabled = node.disabled || (multiple && (value as TreeNodeValue[]).length >= max && max !== 0);
// 过滤状态,渲染节点发生变化,不继续执行副作用
const isFiltering = filterable && inputVal;

if (isDisabled) return;
if (isDisabled || isFiltering) return;
// 点击展开节点,设置展开状态
if (propsTrigger === trigger) {
const expanded = node.setExpanded(true);
Expand Down

0 comments on commit 0956ff0

Please sign in to comment.