From 5b4fbea13fef0d98b9258e49cf24fc8303f4d89a Mon Sep 17 00:00:00 2001 From: wjh Date: Mon, 18 Mar 2024 14:13:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=A1=A5=E5=85=A8=E7=AD=9B=E9=80=89=E5=A4=B1=E6=95=88=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/schema-components/AutoComplete/AutoComplete.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-components/AutoComplete/AutoComplete.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/AutoComplete/AutoComplete.tsx index 9956c56cd..b4ab64506 100644 --- a/packages/plugins/@hera/plugin-core/src/client/schema-components/AutoComplete/AutoComplete.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/schema-components/AutoComplete/AutoComplete.tsx @@ -11,8 +11,13 @@ export const AutoComplete = (props) => { const [defultValue, setDefultValue] = useState([]); const api = useAPIClient(); const [options, setOptions] = useState([]); - const [value, setValue] = useState(''); const form = useForm(); + const autoValue = form.values['custom'] ? form.values['custom'][fieldSchema['collectionName']] : ''; + const [value, setValue] = useState(autoValue); + if (!autoValue && value) { + setValue(''); + setOptions(defultValue); + } useAsyncEffect(async () => { const defultOptions = await api.request({