From b43082e9d229d78326206477eb6df1b85ef9fb07 Mon Sep 17 00:00:00 2001 From: pengm <674192343@qq.com> Date: Fri, 22 May 2026 21:10:48 +0800 Subject: [PATCH] 1.处理手机端搜索不触发 --- src/mobile/components/searchPicker.jsx | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/mobile/components/searchPicker.jsx b/src/mobile/components/searchPicker.jsx index d24472a..6d79d02 100644 --- a/src/mobile/components/searchPicker.jsx +++ b/src/mobile/components/searchPicker.jsx @@ -2,8 +2,10 @@ import { Popup, SearchBar, PickerView, Button } from 'antd-mobile'; import { List,} from 'antd-mobile-v2'; import { useState, useMemo } from 'react'; import styles from "./selectInput.less"; +import iconSetting from '../../assets/mobile/setting.png'; + export default function SearchablePicker(props) { - const { onConfirm, initialValue, data, sTitle, onChange, value:newValue } = props; + const { onConfirm, initialValue, data, sTitle, onChange, value:newValue, onVisibleChange } = props; const [searchValue, setSearchValue] = useState(''); const [visible, setVisible] = useState(false) @@ -32,13 +34,30 @@ export default function SearchablePicker(props) { ); }, [searchValue, data]); // ✅ 必须包含 data const label = filteredOptions?.find(x=>x.value === newValue[0])?.label || '' + + const handleOpen = () => { + setVisible(true); + // 调用onVisibleChange回调 + if (onVisibleChange) { + onVisibleChange(true); + } + }; + const handleConfirm = () => { onChange(values); setVisible(false); + // 调用onVisibleChange回调 + if (onVisibleChange) { + onVisibleChange(false); + } }; const handleCancel = () => { setVisible(false); + // 调用onVisibleChange回调 + if (onVisibleChange) { + onVisibleChange(false); + } }; const changeOption = (val) => { @@ -47,9 +66,7 @@ export default function SearchablePicker(props) { return (
- { - setVisible(true) - }} extra={label}> + {props.iconSettingShow ? // eslint-disable-next-line jsx-a11y/alt-text : ''} -- libgit2 0.22.2