Back to Taro

taro-input

packages/taro-components/src/components/input/readme.md

4.2.05.8 KB
Original Source

taro-input

API

属性类型默认值说明
valueString输入框的初始内容
typeString23input 的类型
passwordBoolean是否是密码类型
placeholderString输入框为空时占位符
placeholder-styleString指定 placeholder 的样式
placeholder-classString指定 placeholder 的样式类
readonlyBoolean是否只读
disabledBoolean是否禁用
maxlengthNumber最大输入长度,设置为 -1 的时候不限制最大长度
cursor-spacingNumber指定光标与键盘的距离,单位 px 。取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离
auto-focusBoolean(即将废弃,请直接使用 focus )自动聚焦,拉起键盘
focusBoolean获取焦点
confirm-typeString设置键盘右下角按钮的文字(目前仅支持search)
cursorNumber指定 focus 时的光标位置
selection-startNumber光标起始位置,自动聚集时有效,需与 selection-end 搭配使用
selection-endNumber光标结束位置,自动聚集时有效,需与 selection-start 搭配使用
adjust-positionBoolean键盘弹起时,是否自动上推页面
√ (onChange)bindinputEventHandle当键盘输入时,触发 input 事件,处理函数可以直接 return 一个字符串,将替换输入框的内容。
√ (onFocus)bindfocusEventHandle输入框聚焦时触发,height 参数在基础库 1.9.90 起支持
√ (onBlur)bindblurEventHandle输入框失去焦点时触发
bindconfirmEventHandle点击完成按钮时触发
<!-- Auto Generated Below -->

Properties

PropertyAttributeDescriptionTypeDefault
autoFocusfocusbooleanfalse
confirmTypeconfirm-typestring'done'
disableddisabledbooleanfalse
maxlengthmaxlengthnumber140
namenamestringundefined
nativeProps--{}{}
passwordpasswordbooleanfalse
placeholderplaceholderstringundefined
readonlyreadonlybooleanfalse
typetypestringundefined
valuevaluestring''

Events

EventDescriptionType
blurCustomEvent<any>
changeCustomEvent<any>
confirmCustomEvent<any>
focusCustomEvent<any>
inputCustomEvent<any>
keydownCustomEvent<any>
pasteCustomEvent<any>

Methods

focus() => Promise<void>

Returns

Type: Promise<void>


Built with StencilJS