fix: 修改自动补全筛选失效问题

This commit is contained in:
wjh 2024-03-18 14:13:58 +08:00
parent d072b32b17
commit 5b4fbea13f

View File

@ -11,8 +11,13 @@ export const AutoComplete = (props) => {
const [defultValue, setDefultValue] = useState([]); const [defultValue, setDefultValue] = useState([]);
const api = useAPIClient(); const api = useAPIClient();
const [options, setOptions] = useState([]); const [options, setOptions] = useState([]);
const [value, setValue] = useState('');
const form = useForm(); 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 () => { useAsyncEffect(async () => {
const defultOptions = await api.request({ const defultOptions = await api.request({