Skip to content

Commit

Permalink
🐛 fix(custom): 修复pc端普通搜索栏清除历史记录不起效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
master1lan committed Mar 5, 2023
1 parent c339497 commit 8856629
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/routers/layout/search/pc/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styles from "../search.module.less";
import pcStyles from "./pc.module.less";
import { useBackRef, useSearchMode } from "./hooks";
import { useNavigate } from "react-router-dom";
import React, { FC, forwardRef, ReactElement, useRef } from "react";
import React, { FC, forwardRef, Fragment, ReactElement, useRef } from "react";
export default function Search() {
const contentRef = useRef<HTMLDivElement>(null);
const { focused, bind } = useSearchFocus();
Expand Down Expand Up @@ -90,7 +90,9 @@ import { InputWrapperContext } from "./context";

//普通搜索
const NormalSearch = () => {
const inputRef = useRef<HTMLInputElement>(null);
const inputRef = useRef<HTMLInputElement>(null),
handlerFocus = () => inputRef.current?.focus();
//为什么需要一个
const { bind } = useSearchFocus(),
{ onBlur } = bind;
const [tag] = useURLParams(["tag"]);
Expand All @@ -110,7 +112,7 @@ const NormalSearch = () => {
addPCTagHistory(value);
};
return (
<>
<div className='flex-grow flex' onClick={handleClick}>
<input
key={tag}
ref={inputRef}
Expand All @@ -129,7 +131,7 @@ const NormalSearch = () => {
/>
<SearchButton onSubmit={handlerSubmit} />
<PCTagSuggest open={open} ClickCallback={handerHistorySubmit} />
</>
</div>
);
};

Expand Down

0 comments on commit 8856629

Please sign in to comment.