From 597ee9d42c3c4235ccfba7dff26ce27cd858da27 Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Mon, 23 Sep 2024 13:26:42 +0800 Subject: [PATCH] fix(Collapse): fix default value --- .../client/src/schema-component/antd/variable/Input.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-component/antd/variable/Input.tsx b/packages/core/client/src/schema-component/antd/variable/Input.tsx index c7c209a88f..3e882c5d36 100644 --- a/packages/core/client/src/schema-component/antd/variable/Input.tsx +++ b/packages/core/client/src/schema-component/antd/variable/Input.tsx @@ -194,7 +194,9 @@ export function Input(props: VariableInputProps) { const form = useForm(); const [options, setOptions] = React.useState([]); const [variableText, setVariableText] = React.useState([]); - const [isFieldValue, setIsFieldValue] = React.useState(children && value != null ? true : false); + const [isFieldValue, setIsFieldValue] = React.useState( + hideVariableButton || (children && value != null ? true : false), + ); const parsed = useMemo(() => parseValue(value, parseOptions), [parseOptions, value]); const isConstant = typeof parsed === 'string'; @@ -239,6 +241,10 @@ export function Input(props: VariableInputProps) { cValue = children ? ['$'] : [' ', type]; } + if (hideVariableButton) { + cValue = ['$']; + } + useEffect(() => { const { component, ...cOption } = constantOption ?? {}; const options = [