diff --git a/components/AutoComplete/index.tsx b/components/AutoComplete/index.tsx index 06ee7a082d..5e148f03ff 100644 --- a/components/AutoComplete/index.tsx +++ b/components/AutoComplete/index.tsx @@ -130,7 +130,12 @@ function AutoComplete(baseProps: AutoCompleteProps, ref) { ...inputProps, ...pickDataAttributes(props), // Empty tag to ensure the consistency of the dom structure of input, such that input won't accidentally lose focus due to structure change on input. - suffix: loading ? : inputProps?.suffix || , + suffix: loading ? ( + + ) : (usedTriggerElement?.type as unknown as { displayName: string })?.displayName === + 'Search' ? undefined : ( + inputProps?.suffix || + ), onFocus: (event) => { setIsFocused(true); onFocus?.(event); diff --git a/components/Input/search.tsx b/components/Input/search.tsx index f03914d917..1f16635935 100644 --- a/components/Input/search.tsx +++ b/components/Input/search.tsx @@ -13,8 +13,18 @@ import { isObject } from '../_util/is'; const Search = React.forwardRef((props: InputSearchProps, ref) => { const { getPrefixCls } = useContext(ConfigContext); - const { className, style, placeholder, disabled, searchButton, loading, defaultValue, ...rest } = - props; + const { + className, + style, + placeholder, + disabled, + searchButton, + loading, + defaultValue, + addAfter, + suffix, + ...rest + } = props; const trueMaxLength = isObject(props.maxLength) ? props.maxLength.length : props.maxLength; const mergedMaxLength = @@ -48,7 +58,9 @@ const Search = React.forwardRef((props: InputSea ref={ref} placeholder={placeholder} addAfter={ - searchButton ? ( + addAfter !== undefined ? ( + addAfter + ) : searchButton ? ( ) : null } - suffix={!searchButton && (loading ? : )} + suffix={ + suffix !== undefined + ? suffix + : !searchButton && (loading ? : ) + } onChange={(value, e) => { setValue(value); props.onChange && props.onChange(value, e);