跳到主要内容

eo-input

<eo-input>
Alias: <form.general-input>

表单输入框构件。

Playground

Examples

Label

Playground

Value

Playground

Disabled

Playground

Clearable

Playground

Placeholder

Playground

max length

Playground

Type

Playground

Size

Playground

Input Style

Playground

Event

Playground

Slot

Playground

With Form

Playground

Properties

NameDescriptionTypeDefaultRequired
name

字段名称

string
label

标签文字

string
required

是否必填

boolean
pattern

正则校验规则

string
max

表单校验最大长度(当 type 为 number 时,表示最大值)

number
min

表单校验最小长度(当 type 为 number 时,表示最小值)

number
message

错误时显示消息

Record<string, string>
value

输入框值

string
placeholder

占位说明

string
disabled

是否禁用

boolean
readonly

是否只读

boolean
clearable

是否显示清除按钮

boolean
autoFocus

是否自动聚焦

boolean
type

类型

InputType "text"
size

大小

ComponentSize "medium"
minLength

最小长度

number
maxLength

最大长度(用户无法输入超过此最大长度的字符串)

number
inputStyle

输入框样式

React.CSSProperties
validator

表单项校验方法

((value: any) => MessageBody)

Slots

NameDescription
addonBefore

输入框前置标签

addonAfter

输入框后置标签

prefix

输入框前缀图标

suffix

输入框后缀图标

Events

NameDescriptionEvent Detail
change

值改变事件

string

Methods

NameDescriptionParamsReturns
focusInput

focus

blurInput

blur

Parts

NameDescription
addon-wrapper

包裹输入组件、前缀、后缀、前置和后置的容器

affix-wrapper

包裹输入组件、前缀和后缀的容器

input

输入组件

clear-icon

清除按钮

prefix

输入框前缀容器

suffix

输入框后缀容器

before-addon

输入框前置容器

after-addon

输入框后置容器

Type references

InputType

"button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week"

ComponentSize

"large" | "medium" | "small" | "xs"