forgeplus-react/src/forge/Component/HeadSearch.jsx

22 lines
770 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { useState } from "react";
import { Input} from "antd";
import './Component.scss';
export default ({history}) => {
const [searchValue, setSearchValue] = useState("");
function onGlobalSearch(e) {
window.location.href = `/search?value=${e.target.value}`;
}
return (
<React.Fragment>
<div className="headSerach aboutSubTitle" onBlur={()=>{setTimeout(() => {
setSearchValue("");
}, 500)}}>
<i className = "iconfont icon-bianzu11 font-15" onClick={()=>onGlobalSearch({target:{value:searchValue}})}></i>
<Input placeholder="请输入搜索关键字" onPressEnter={onGlobalSearch} onChange={(value)=>setSearchValue(value.target.value)} value={searchValue}></Input>
</div>
</React.Fragment>
)
};