0.0.2 • Published 7 years ago

react-bhy-textfield v0.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

react-bhy-textfield

page loading demo:

https://baohaoyu.github.io/react-bhy-textfield/test/index.html

props

nametypedefault valueexplain
classNamestring''根节点的class
labelWithstringlabel的宽度
layoutstring布局 x:水平布局 y:垂直布局
themestring'border'样式:border:带有边框 line:只有下边框
languagestringTODO 语言:'en' or 'cn',目前只有cn
sizestringinput的尺寸 sm:小尺寸
showLabelbool是否显示label
inputWithstringinput的宽度
fullboolfalse组件宽度是否填满父组件
labelstring''label的内容
typestringinput标签的type
titlestringinput标签的title
namestringinput标签的name
placeholderstringinput标签的placeholder
passSetValuebool通过验证才设置input的值
valueany''input标签的value
defaultValueanyinput标签的defaultValue
maxnumber最多字符长度
minnumber最小字符长度
maxErrorTextstringlabel不可以超过max个字符!超过最多字符限制后显示的警告,会自动他label替换成props.label,max替换成props.max
minErrorTextstringlabel不可少于min个字符!少于最少字符限制后显示的警告
rexsarray正则表达式 {rex:'正则表达式',passIsRight:true 正则表达式匹配表示正确 false 正则表达式匹配表示错误,errorText:没有通过验证显示的警告内容}
rexrex单个正则表达式
rexErrorTextstringlabel格式不对!没有通过正则表单时验证,显示的警告内容
emptyErrorTextstring请填写label空表单显示的警告内容
rexPassIsRightstringbooltrue: 通过props.rex 验证表示正确,false:通过props.rex 验证表示错误
requirebooltrue不可为空
onChangefunc() => {}input值改变后触发 ,参数({e,errorText,pass}})
onFocusfunc() => {}input获得焦点后触发 ,参数({e,errorText,pass}})
onBlurfunc() => {}input失去焦点变后触发 ,参数({e,errorText,pass}})
errorTextstring''外部传入的警告内容,如果errorText有具体内容的话,组件会一直显示警告状态
lineBorderColorstringporps.theme == 'line'的时候,input的下边横线的颜色
lineFocusColorstringporps.theme == 'line'的时候 ,input获得焦点后动画线的颜色
lineErrorColorstringporps.theme == 'line'的时候 ,警告状态下,input获得焦点后动画线的颜色
errorTextColorstring警告状态下,错误提示,label,input的颜色
iconClassstringinput左侧的小图标的class,推销使用 font awesome
iconOffsetobject{left: 0, top: 0}input左侧的小图标的位置偏移
inputHeightnumberinput的高度