-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Bug Report] PreviewText.Cascader 异步获取的数据无法获取到选择的数据名称 #4353
Copy link
Copy link
Closed
Labels
invalidThis doesn't seem rightThis doesn't seem right
Description
通过请求获取到的数据结构如下图
在组件属性里配置了 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,
}
})
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
invalidThis doesn't seem rightThis doesn't seem right