Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧐[问题]ProFormTreeSelect获取不到halfChecked #8869

Open
benz1997 opened this issue Nov 15, 2024 · 0 comments
Open

🧐[问题]ProFormTreeSelect获取不到halfChecked #8869

benz1997 opened this issue Nov 15, 2024 · 0 comments

Comments

@benz1997
Copy link

benz1997 commented Nov 15, 2024

🧐 问题描述

如图所示,目前可以获取到checked的value,但获取不到父级节点的value(也就是halfChecked),以下是onchange打印的

image

image

halfChecked是没数据的,label居然也是null的,下面是我组件配置的示例代码

💻 示例代码

//  组件配置
<ProFormTreeSelect
        name="menu_ids"
        label={<FormattedMessage id={locales.pageSystemRoleDetailMenu} />}
        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的数据呢?

@benz1997 benz1997 changed the title 🧐[问题]ProFormTreeSelect获取不到halfChekced,求助 🧐[问题]ProFormTreeSelect获取不到halfChecked,求助 Nov 15, 2024
@benz1997 benz1997 changed the title 🧐[问题]ProFormTreeSelect获取不到halfChecked,求助 🧐[问题]ProFormTreeSelect获取不到halfChecked Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant