From d5268477e8f02b3ceaceb7f386d9809831efd31a Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Thu, 24 Nov 2022 14:26:07 +0000 Subject: [PATCH] implement events props --- packages/app/src/components/Searcher/index.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/app/src/components/Searcher/index.jsx b/packages/app/src/components/Searcher/index.jsx index 7e31a484..2360d5aa 100755 --- a/packages/app/src/components/Searcher/index.jsx +++ b/packages/app/src/components/Searcher/index.jsx @@ -131,6 +131,16 @@ export default (props) => { setLoading(false) }, 400) + if (searchValue === "") { + if (typeof props.onEmpty === "function") { + props.onEmpty() + } + } else { + if (typeof props.onFilled === "function") { + props.onFilled() + } + } + return () => clearTimeout(timer) }, [searchValue]) @@ -142,7 +152,9 @@ export default (props) => { onChange={handleOnSearch} value={searchValue} prefix={} - autoFocus + autoFocus={props.autoFocus ?? false} + onFocus={props.onFocus} + onBlur={props.onUnfocus} /> {searchResult &&