更新图标

This commit is contained in:
2022-05-09 11:58:33 +08:00
parent d5622d5b0a
commit b5e967779c
20 changed files with 1934 additions and 32 deletions
+8 -4
View File
@@ -3,7 +3,7 @@ import styles from "./index.module.scss"
import CloseBtn from "@/components/closeBtn"
import classnames from "classnames";
import { debounce } from "@/common/util";
import { memo, useEffect, useRef, useState } from "react";
import { forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from "react";
type Params = {
clickOnSearch?: (val: string) => void
@@ -19,7 +19,7 @@ type Params = {
debounceTime?: number //防抖时间,不设默认为零
}
export default memo(({
export default forwardRef(({
clickOnSearch,
changeOnSearch,
disabled = false,
@@ -29,8 +29,8 @@ export default memo(({
btnStyle = {},
placeIcon = 'inner',
btnTitle = '搜索',
debounceTime = 0
}:Params) => {
debounceTime = 0,
}:Params, ref) => {
const [inputCon , setInputCon] = useState('')
const debounceTimeRef = useRef(0)
@@ -43,6 +43,10 @@ export default memo(({
changeData(value)
}
useImperativeHandle(ref, () => ({
clearInput
}))
const clearInput = () => {
setInputCon('')
changeOnSearch?.('')