更新图标
This commit is contained in:
@@ -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?.('')
|
||||
|
||||
Reference in New Issue
Block a user