index.tsx
650 Bytes
import { Input, type InputProps, type InputRef } from 'antd';
import { forwardRef } from 'react';
export type UInputProps = InputProps;
/** 项目统一输入框,默认开启 allowClear。 */
const UInputBase = forwardRef<InputRef, UInputProps>(({ allowClear = true, ...rest }, ref) => (
<Input ref={ref} allowClear={allowClear} {...rest} />
));
UInputBase.displayName = 'UInput';
/** 复合形态均沿用 antd 同名子组件;Password/TextArea/Search 默认不开 allowClear。 */
export const UInput = Object.assign(UInputBase, {
Password: Input.Password,
TextArea: Input.TextArea,
Search: Input.Search,
});
export default UInput;