-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Bug Report] PreviewText.Cascader 异步获取的数据无法获取到选择的数据名称 #4354
Copy link
Copy link
Open
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
通过请求获取到的数据结构如下图
在组件属性里配置了 x-component-props: {fieldNames: "{{{ label: "name", value: "code"}}}", showSearch: true},编辑状态是没问题的,但是在阅读态模式下不能显示选择的数据名称
看了PreviewText.Cascader源码,内部没有处理 fieldNames 配置的逻辑。但是重新自定义Cascader组件时使用mapReadPretty似乎无法传入异步获取到的数据属性,自定义代码如下:
function PreviewTextCascader(props: CascaderProps) {
// 这里 props 里拿不到异步请求的 dataSource 或 options 数据
console.log('PreviewTextCascader', props)
return null
}
const CascaderComponent = connect(
AntCascader,
mapProps({ dataSource: 'options' }, (props) => ({ ...props })),
mapReadPretty(PreviewTextCascader),
)
......
const SchemaField = createSchemaField({
components: {
Cascader: CascaderComponent,
}
})
What is expected?
PreviewText.Cascader 内部添加处理 fieldNames 配置的逻辑
What is actually happening?
PreviewText.Cascader 内部没有处理 fieldNames 配置的逻辑
Package
@formily/antd-v5@1.2.4
@formily/react@2.3.7
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels