Skip to content

Input 输入框

规则

基础示例

密码框

Props 配置示例

整段禁用

尺寸对比(迷你 / 小 / 中)

文本域 + 字数

Events 示例

Props

名称类型默认值说明
autocompletestring'off'原生 autocomplete 属性
autofocusbooleanfalse页面加载时自动获取焦点
autosizeboolean |false自适应内容高度(仅 textarea)
clearableboolean是否显示清除按钮(不适用于 textarea)
colsstring | number原生属性(textarea 有效)
counterbooleanfalse是否显示字数统计
disabledbooleanfalse是否禁用
display-onlyboolean设置文本只读态
display-only-contentstring只读态的文本内容区
formstring原生属性
hover-expandboolean文本域悬浮展开/收起(textarea)
input-box-type'normal' | 'underline'normal边框模式
labelstring等价于原生 input aria-label
maskboolean启用掩码功能(disabled/display-only 生效)
maxnumber原生属性,最大值
maxlengthnumber原生属性,最大长度
memory-spacenumber5addMemory 最大保存条目数量
minnumber原生属性,最小值
modelValue / v-modelstring | number绑定值
namestring原生 name 属性
placeholderstring占位文本
popup-moreboolean只读态下显示更多按钮
prefix-iconComponent头部图标
readonlybooleanfalse原生属性,只读
resize'both' | 'horizontal' | 'vertical' | 'none'控制是否可缩放
rowsstring | number2行数(textarea)
show-passwordbooleanfalse是否显示切换密码图标
show-tooltipbooleantrue只读状态下超出是否悬浮提示
show-word-limitbooleanfalse是否显示输入字数统计
size'medium' | 'small' | 'mini'输入框尺寸
stepnumber原生属性,合法数字间隔
suffix-iconComponent尾部图标
tabindexstring原生 tabindex
type'text' | 'textarea' | 'password' | InputHTMLAttributes.type'text'输入框类型
validate-eventbooleantrue输入时是否触发表单校验

Events

名称类型说明
blur(event: FocusEvent) => void失去焦点触发
change(value: string | number) => void值改变触发
clear() => void点击清空按钮触发
focus(event: FocusEvent) => void获得焦点触发
input(event: InputEvent) => void输入时触发

FormCreate 是一个开源项目,基于 MIT 许可证发布,欢迎个人和企业用户免费使用