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