mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: picker选中项不显示label问题修复
This commit is contained in:
parent
5e2d90d8b1
commit
244d4a935b
@ -1182,7 +1182,7 @@ export const FormItemStore = StoreNode.named('FormItemStore')
|
||||
selected.forEach((item, index) => {
|
||||
const value = getOptionValue(item, valueField);
|
||||
if (flattenedMap.get(value)) {
|
||||
selectedOptions.push(item);
|
||||
selectedOptions.push(flattenedMap.get(value));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -579,23 +579,16 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
this.renderHeaderToolbar = this.renderHeaderToolbar.bind(this);
|
||||
this.renderFooterToolbar = this.renderFooterToolbar.bind(this);
|
||||
}
|
||||
// picker的数据如果是异步加载,那么初始的value其实是{id: ' 7', engine: ' 7', __unmatched: true}这种样子的
|
||||
// 拿到数据后又会变成真实数据,类似这种{browser: "Firefox 1.0", engine: "Gecko - syo6k7", grade: "A", group: "train", id: 7, platform: "Win 98+ / OSX.2+", version: "1.7"}
|
||||
// 因此比较value是否更改,只比较关键字段即可,否则会执行多次setSelectedItems
|
||||
// 显隐切换时,也会导致需要二次点击才能选中的问题
|
||||
|
||||
let val: any;
|
||||
const valueField = props.valueField || props.primaryField;
|
||||
|
||||
if (
|
||||
this.props.pickerMode &&
|
||||
isArrayChildrenModified(
|
||||
(val = getPropValue(this.props))?.map((item: any) => item[valueField]),
|
||||
getPropValue(prevProps)?.map((item: any) => item[valueField])
|
||||
(val = getPropValue(this.props)),
|
||||
getPropValue(prevProps)
|
||||
) &&
|
||||
!isEqual(
|
||||
val?.map((item: any) => item[valueField]),
|
||||
store.selectedItems.concat().map((item: any) => item[valueField])
|
||||
)
|
||||
!isEqual(val, store.selectedItems.concat())
|
||||
) {
|
||||
/**
|
||||
* 更新链:Table -> CRUD -> Picker -> Form
|
||||
|
Loading…
Reference in New Issue
Block a user