Skip to content

Input 输入框

规则

js
{
    type:"input",
    title:"商品名称",
    field:"goods_name",
    value:"iphone 7",
    col:{
    	span:12,
    	labelWidth:150
    },
    props: {
        type: "text",
    },
    validate:[
        { required: true, message: '请输入goods_name', trigger: 'blur' },
    ],
}
{
    type:"input",
    title:"商品名称",
    field:"goods_name",
    value:"iphone 7",
    col:{
    	span:12,
    	labelWidth:150
    },
    props: {
        type: "text",
    },
    validate:[
        { required: true, message: '请输入goods_name', trigger: 'blur' },
    ],
}

参考:Element_Input

value :String

Props

参数说明类型可选值默认值
type类型stringtext,textarea 和其他 原生 input 的 type 值text
maxlength原生属性,最大输入长度number
minlength原生属性,最小输入长度number
placeholder输入框占位文本string
clearable是否可清空booleanfalse
disabled禁用booleanfalse
size输入框尺寸,只在 type!="textarea" 时有效stringmedium / small / mini
prefixIcon输入框头部图标string
suffixIcon输入框尾部图标string
rows输入框行数,只对 type="textarea" 有效number2
autosize自适应内容高度,只对 type="textarea" 有效,可传入对象,如,{ minRows: 2, maxRows: 6 }boolean / objectfalse
autocomplete原生属性,自动补全stringon, offoff
autoComplete下个主版本弃用stringon, offoff
name原生属性string
readonly原生属性,是否只读booleanfalse
max原生属性,设置最大值
min原生属性,设置最小值
step原生属性,设置输入字段的合法数字间隔
resize控制是否能被用户缩放stringnone, both, horizontal, vertical
autofocus原生属性,自动获取焦点booleantrue, falsefalse
form原生属性string
label输入框关联的label文字string
tabindex输入框的tabindexstring--
validateEvent输入时是否触发表单的校验boolean-true

Events

事件名称说明回调参数
blur在 Input 失去焦点时触发(event: Event)
focus在 Input 获得焦点时触发(event: Event)
change在 Input 值改变时触发(value: string | number)
clear在点击由 clearable 属性生成的清空按钮时触发