input(输入框)
属性名 | 类型 | 说明 | 平台差异 |
---|---|---|---|
value | String | 输入框的初始内容 | |
type | String | input 的类型 | |
password | Boolean(默认false) | 是否是密码类型 | |
placeholder | String | 输入框为空时占位符 | |
placeholder-style | String | 指定 placeholder 的样式 | |
placeholder-class | String | “input-placeholder” 指定 placeholder 的样式类 | |
disabled | Boolean(默认false) | 是否禁用 | |
maxlength | Number (默认140) | 最大输入长度,设置为 -1 的时候不限制最大长度 | |
cursor-spacing | Number (默认0) | 指定光标与键盘的距离,单位 px 。取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 | App、微信小程序、百度小程序、QQ小程序 |
focus | Boolean (默认false) | 获取焦点 | 在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。 |
confirm-type | String (默认done) | 设置键盘右下角按钮的文字,仅在 type=“text” 时生效 | |
confirm-hold | Boolean (默认false) | 点击键盘右下角按钮时是否保持键盘不收起 | App、微信小程序、支付宝小程序、百度小程序、QQ小程序 |
cursor | Number | 指定focus时的光标位置 | |
selection-start | Number (默认-1) | 光标起始位置,自动聚集时有效,需与selection-end搭配使用 | |
selection-end | Number (默认-1) | 光标结束位置,自动聚集时有效,需与selection-start搭配使用 | |
adjust-position | Boolean (默认true) | 键盘弹起时,是否自动上推页面 | App(softinputMode 为 adjustResize 时无效)、微信小程序、百度小程序、QQ小程序 |
hold-keyboard | Boolean (默认false) | focus(获得焦点)时,点击页面的时候不收起键盘 | 微信小程序2.8.2 |
@input | EventHand |