ant-design / ant-design/pro-components
🧐[问题]ProFormTreeSelect获取不到halfChecked
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
### 🧐 问题描述
如图所示,目前可以获取到checked的value,但获取不到父级节点的value(也就是halfChecked),以下是onchange打印的


halfChecked是没数据的,label居然也是null的,下面是我组件配置的示例代码
### 💻 示例代码
```
// 组件配置
}
fieldProps={{
virtual: false,
treeLine: true,
treeNodeFilterProp: 'title',
showSearch: true,
filterTreeNode: true,
labelInValue: true,
treeCheckStrictly: false,
treeCheckable: true,
showCheckedStrategy: TreeSelect.SHOW_ALL,
onChange: (value, label) => {
console.log('change', value, label);
},
}}
request={async () => {
const result = await getMenuManagementList({});
return convertToTreeFormat(result.data);
}}
/>
// 转换动态数据convertToTreeFormat
export function convertToTreeFormat(data: SystemType.Menu[]): TreeNode[] {
return data.map((item) => ({
title: item.menu_names[currentLang] || item.menu_names['en'],
value: item.id,
key: item.id,
children: item.children ? convertToTreeFormat(item.children) : undefined,
}));
}
```
请问TreeSelect这个组件还有什么方式获取到halfChecked的数据呢?
Contributor guide
Research direction
Start at the ProFormTreeSelect fieldProps entry point and trace how the provided TreeSelect onChange receives labelInValue, treeCheckable, and treeCheckStrictly values. Reproduce the configuration with the shown convertToTreeFormat data, then compare the emitted value and label with the expected parent halfChecked values. Done means the behavior is explained and the component or usage path provides the requested half-checked data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100