/// import * as React from "react"; interface HTMLAttributesWeak extends React.HTMLAttributes { defaultValue?: any; onChange?: any; } export interface InputProps extends HTMLAttributesWeak { /** * 样式前缀 */ prefix?: string; /** * 当前值 */ value?: string | number; /** * 初始化值 */ defaultValue?: string | number; /** * 尺寸 */ size?: "small" | "medium" | "large"; /** * 状态 设置文本域禁用状态 */ disabled?: boolean; /** * 是否为多行,不选则为单行 */ multiple?: boolean; /** * 最大长度 */ maxLength?: number; /** * 是否展现最大长度样式 */ hasLimitHint?: boolean; /** * 是否允许切割字符串 */ cutString?: boolean; /** * 是否出现clear按钮 */ hasClear?: boolean; /** * 状态(multiple模式不支持 loading/success 状态) */ state?: "" | "error" | "loading" | "success"; /** * 自定义内联样式 */ style?: React.CSSProperties; /** * 原生type */ htmlType?: string; /** * 只读 */ readOnly?: boolean; /** * onChange返回会自动去除头尾空字符 */ trim?: boolean; /** * 文本域前附加内容 */ addonBefore?: React.ReactNode; /** * 文本域后附加内容 */ addonAfter?: React.ReactNode; /** * 输入提示 */ placeholder?: string; /** * 按下回车的回调 */ onPressEnter?: () => void; /** * 失去焦点时候触发的回调 */ onBlur?: () => void; /** * 发生改变的时候触发的回调 */ onChange?: (value: string, e: any) => void; /** * 自定义字符串计算长度方式 */ getValueLength?: (value: string) => number; /** * multiple多行文本框高度
(不要直接用height设置多行文本框的高度, ie9 10会有兼容性问题) */ rows?: number; /** * 文字缩进 */ textIndent?: number; /** * 自定义class */ className?: string; } export default class Input extends React.Component {}