Skip to content

Commit

Permalink
Update index.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaochong444 authored Nov 19, 2023
1 parent 8fb721f commit 7819ac2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/components/src/preview-text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ const TreeSelect: React.FC<React.PropsWithChildren<TreeSelectProps<any>>> =
dataSource: any[],
treeNodeLabelProp?: string
) => {
const valueKey = props.fieldNames?.value || 'value'
for (let i = 0; i < dataSource?.length; i++) {
const item = dataSource[i]
if (item?.value === value) {
if (item?.[valueKey] === value) {
return item?.label ?? item[treeNodeLabelProp as string]
} else {
const childLabel = findLabel(value, item?.children, treeNodeLabelProp)
Expand Down

0 comments on commit 7819ac2

Please sign in to comment.