From 0741cd4a01d23d477e5f9102791a138e73ec198a Mon Sep 17 00:00:00 2001 From: jinye Date: Tue, 27 Aug 2024 11:25:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BA=A7=E8=81=94?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=99=A8=E6=95=B0=E6=8D=AE=E6=BA=90=E5=BC=82?= =?UTF-8?q?=E5=B8=B8label=E4=B8=BA=E6=95=B0=E7=BB=84=E6=97=B6=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=B4=A9=E6=BA=83=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis/src/renderers/Form/NestedSelect.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/amis/src/renderers/Form/NestedSelect.tsx b/packages/amis/src/renderers/Form/NestedSelect.tsx index 9ef35142e..da81e00b4 100644 --- a/packages/amis/src/renderers/Form/NestedSelect.tsx +++ b/packages/amis/src/renderers/Form/NestedSelect.tsx @@ -29,7 +29,8 @@ import { ActionObject, renderTextByKeyword, getVariable, - TestIdBuilder + TestIdBuilder, + labelToString } from 'amis-core'; import {findDOMNode} from 'react-dom'; import xor from 'lodash/xor'; @@ -250,15 +251,17 @@ export default class NestedSelectControl extends React.Component< const regexp = string2regExp(inputValue); if (hideNodePathLabel) { - return option[labelField || 'label']; + return labelToString(option[labelField || 'label']); } const ancestors = getTreeAncestors(options, option, true); - const optionText = option[labelField || 'label']; + const optionText = labelToString(option[labelField || 'label']); const splitJoin = ' / '; const title = ancestors - ? ancestors.map(item => item[labelField || 'label']).join(splitJoin) + ? ancestors + .map(item => labelToString(item[labelField || 'label'])) + .join(splitJoin) : optionText; return ( @@ -269,7 +272,7 @@ export default class NestedSelectControl extends React.Component< > {ancestors ? ancestors.map((item, index) => { - const label = item[labelField || 'label']; + const label = labelToString(item[labelField || 'label']); const value = item[valueField || 'value']; const isEnd = index === ancestors.length - 1; return ( @@ -709,7 +712,7 @@ export default class NestedSelectControl extends React.Component< selfChecked = true; } - let label = option[labelField || 'label']; + let label = labelToString(option[labelField || 'label']); return (