1 | import React from "react";
|
2 | import { DebounceBtn, ResetButton } from "@comps/Buttons";
|
3 | import styles from "./SearchBar.scss";
|
4 | import { message } from "antd";
|
5 | let loading = false;
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export default function SearchBar({ children, onReset, onSearch }) {
|
14 | const _search = () => {
|
15 | if (loading) return;
|
16 | message.info("正在查询..", 1);
|
17 | loading = true;
|
18 | setTimeout(() => (loading = false), 1500);
|
19 | onSearch();
|
20 | };
|
21 | return (
|
22 | <div className={styles.container}>
|
23 | <div className={styles.forms}>{children}</div>
|
24 | <div className={styles.btns}>
|
25 | {onReset && <ResetButton onClick={onReset} />}
|
26 | <DebounceBtn onClick={_search} style={{ marginLeft: "5px" }}>
|
27 | 查询
|
28 | </DebounceBtn>
|
29 | </div>
|
30 | </div>
|
31 | );
|
32 | }
|