Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions web/src/components/common/ui/JSONEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const JSONEditor = ({
editorType = 'keyValue',
rules = [],
formApi = null,
renderStringValueSuffix,
...props
}) => {
const { t } = useTranslation();
Expand Down Expand Up @@ -335,7 +336,7 @@ const JSONEditor = ({
]);

// 渲染值输入控件(支持嵌套)
const renderValueInput = (pairId, value) => {
const renderValueInput = (pairId, pairKey, value) => {
const valueType = typeof value;

if (valueType === 'boolean') {
Expand Down Expand Up @@ -387,6 +388,7 @@ const JSONEditor = ({
<Input
placeholder={t('参数值')}
value={String(value)}
suffix={renderStringValueSuffix?.({ pairId, pairKey, value })}
onChange={(newValue) => {
let convertedValue = newValue;
if (newValue === 'true') convertedValue = true;
Expand Down Expand Up @@ -470,7 +472,9 @@ const JSONEditor = ({
)}
</div>
</Col>
<Col span={12}>{renderValueInput(pair.id, pair.value)}</Col>
<Col span={12}>
{renderValueInput(pair.id, pair.key, pair.value)}
</Col>
<Col span={2}>
<Button
icon={<IconDelete />}
Expand Down
Loading