1- ## InputItem 文本输入
2-
31文本输入。
42
5- 扫码体验:
6-
3+ ## 扫码体验
74<img src =" https://gw.alipayobjects.com/zos/rmsportal/HoUOLnPEOaymuHlbeyqR.jpeg " width =" 154 " height =" 190 " />
85
6+ ## 效果示例
7+ ![ 输入框.png] ( https://intranetproxy.alipay.com/skylark/lark/0/2019/png/188518/1564389321807-3fdc73ec-f8c4-454b-aa2b-69121edd0d25.png )
8+
9+ ## 属性
910| 属性名 | 描述 | 类型 | 默认值 |
1011| ---- | ----| ----| ----|
1112| className | 自定义的class | String| '' |
1415| last | 是否最后一行 | Boolean | false |
1516| value | 初始内容 | String | '' |
1617| name | 组件名字,用于表单提交获取数据 | String | '' |
17- | type | input 的类型,有效值:` text ` , ` number ` , ` idcard ` , ` digit ` | String | text |
18+ | type | input 的类型,有效值:` text ` , ` number ` , ` idcard ` , ` digit ` | String | text |
1819| password | 是否是密码类型 | Boolean | false |
1920| placeholder | 占位符 | String | '' |
2021| placeholderStyle | 指定 placeholder 的样式 | String | '' |
2930| onBlur | 失去焦点时触发 | (e: Object) => void | |
3031| onClear | 点击清除icon时触发 | () => void | |
3132
33+ ### type 属性值介绍
34+ * ` text ` : 字符输入框
35+ * ` number ` : 纯数字输入框( 0-9 之间的数字)
36+ * ` idcard ` :身份证输入框( 0-9 之间的数字,以及字符 x)
37+ * ` digit ` :数字输入框,( 0-9 之间的数字,以及小数点 . 字符,可用于含有小数的数字)
38+
39+ ** 注** :` type ` 的属性值影响的是真机中的键盘类型,在模拟器中并不一定会有效果。
40+
3241## slots
3342
3443| slotname | 说明 |
3544| ---- | ---- |
3645| extra | 可选,用于渲染input-item项右边说明 |
3746
38- ## 示例
47+ ## 示例代码
3948
4049``` json
50+ // API-DEMO page/component/input-item/input-item.json
4151{
4252 "defaultTitle" : " 小程序AntUI组件库" ,
4353 "usingComponents" : {
4959}
5060```
5161
52- ``` axml
62+ ``` html
63+ <!-- API-DEMO page/component/input-item/input-item.axml -->
5364<view >
5465 <view style =" margin-top : 10px ;" />
5566 <list >
108119```
109120
110121``` javascript
122+ // API-DEMO page/component/input-item/input-item.js
111123const banks = [' 网商银行' , ' 建设银行' , ' 工商银行' , ' 浦发银行' ];
112124
113125Page ({
@@ -159,6 +171,7 @@ Page({
159171```
160172
161173``` css
174+ /* API-DEMO page/component/input-item/input-item.acss */
162175.extra {
163176 background-image : url (' https://gw.alipayobjects.com/zos/rmsportal/dOfSJfWQvYdvsZiJStvg.svg' );
164177 background-size : contain ;
@@ -169,4 +182,4 @@ Page({
169182 width : 20px ;
170183 padding-left : 10px ;
171184}
172- ```
185+ ```
0 commit comments