hejianhao
2026-06-30 93611f26a5aa8bea06d2abb181122cdba3dd1944
Revert "fix(站点搜索页): 优化搜索输入框焦点与光标处理"

This reverts commit ffd7b31da2a2a69520ed244b8ef347d74eaad6fa.
1个文件已修改
25 ■■■■■ 已修改文件
src/robotaxi/pages/site-search/index.tsx 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/site-search/index.tsx
@@ -67,8 +67,6 @@
function SiteSearchPage() {
  const [searchValue, setSearchValue] = useState('') //搜索值
  const [searchCursor, setSearchCursor] = useState(0)
  const [shouldFocusSearchInput, setShouldFocusSearchInput] = useState(true)
  const [showAllHistory, setShowAllHistory] = useState(false) // 是否展示全部历史记录
  const [showAllRecommend, setShowAllRecommend] = useState(false) // 是否展示全部推荐站点
  const [distanceConfig, setDistanceConfig] = useState<any>({})
@@ -185,13 +183,8 @@
  });
  const changeSearchValue = (e: any) => {
    const val = String(e?.detail?.value || '');
    const nextCursor = typeof e?.detail?.cursor === 'number'
      ? e.detail.cursor
      : val.length;
    const val = e.detail.value;
    setSearchValue(val);
    setSearchCursor(nextCursor);
    setShouldFocusSearchInput(true);
    debouncedSearch(val);
    return val;
  }
@@ -419,8 +412,6 @@
  const clearSearchValue = () => {
    setSearchValue('');
    setSearchCursor(0);
    setShouldFocusSearchInput(true);
    clearSearchResults();
  }
  const handleCloseTipPopup = () => {
@@ -542,20 +533,8 @@
        <View className={`search-icon ${pageType == 'end' ? 'end-icon' : ''}`}></View>
        <View className='search-input-box'>
          <Input className='search-input' placeholder={pageType == 'start' ? '请输入上车点' : '请输入目的地'} value={searchValue}
            cursor={searchCursor}
            focus={shouldFocusSearchInput}
            onInput={(e) => changeSearchValue(e)}
            onFocus={(e) => {
              const nextCursor = typeof e?.detail?.cursor === 'number'
                ? e.detail.cursor
                : searchValue.length;
              setSearchCursor(nextCursor);
              setShouldFocusSearchInput(true);
            }}
            onBlur={() => {
              setShouldFocusSearchInput(false);
              flushDebouncedSearch();
            }}
            onBlur={flushDebouncedSearch}
            onConfirm={(e) => {
              const keyword = e?.detail?.value || searchValue; // 确认搜索关键字,优先取输入框事件值
              confirmSearch(keyword);