Skip to content

EPInput 输入框组件

默认去除空格(^0.2.9)

使用 inputRule 正则 (^0.2.9)

常见类型

输入整数

尺寸

代码示例

<EPInput v-model="value" />

EPInput 属性


配置参数

属性名说明类型默认值
v-model绑定值string-
inputType类型integer | default|'' ``
inputRule类型RegExp-

继承

属性名说明类型默认值
type类型enumtext
v-model绑定值string/ number
maxlength同原生 maxlength 属性string/ number
minlength同原生 minlength 属性string/ number
show-word-limit是否显示字数统计,仅在 type 为 'text' 或 'textarea' 时生效booleanfalse
placeholder输入框占位文本string
clearable是否显示清除按钮,仅在 type 不是 'textarea' 时生效booleanfalse
formatter指定输入值的格式。(只有当 type 为 'text' 时才能工作)Funcion
parser指定从格式化器输入中提取的值。(仅当 type 为 'text' 时才起作用)Funcion
show-password是否显示切换密码图标booleanfalse
disabled是否禁用输入框booleanfalse
size输入框尺寸,仅在 type 不是 'textarea' 时有效enum
prefix-icon自定义前缀图标string / Component
suffix-icon自定义后缀图标string / Component
rows输入框行数,仅在 type 为 'textarea' 时有效number2
autosizetextarea 高度是否自适应,仅在 type 为 'textarea' 时生效。可以接受一个对象,比如: { minRows: 2, maxRows: 6 }boolean / object{ minRows?: number, maxRows?: number }false
autocomplete同原生 autocomplete 属性stringoff
name同原生 name 属性string
readonly同原生 readonly 属性,是否只读booleanfalse
max同原生 max 属性
min同原生 min 属性
step同原生 step 属性
resize控制是否能被用户缩放enum
autofocus同原生 autofocus 属性booleanfalse
form同原生 form 属性string
aria-label同原生 aria-label 属性string

事件

名称说明类型
blur当输入框失去焦点时触发Function(event: FocusEvent) => void
focus当输入框获得焦点时触发Function(event: FocusEvent) => void
change当输入框失去焦点或用户按下 Enter 键时触发,仅当 modelValue 发生变化时触发Function(value: string | number) => void
input当输入框的值发生变化时触发Function(value: string | number) => void
clear当通过点击清除按钮清空输入框时触发Function() => void

插槽

名称说明
prefix输入框前缀内容,仅在 type 不是 'textarea' 时生效
suffix输入框后缀内容,仅在 type 不是 'textarea' 时生效
prepend输入框前置内容,仅在 type 不是 'textarea' 时生效
append输入框后置内容,仅在 type 不是 'textarea' 时生效