1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
| import fmtEvent from '../_util/fmtEvent';
| import fmtUnit from '../_util/fmtUnit';
| Component({
| props: {
| className: '',
| labelCls: '',
| inputCls: '',
| last: false,
| value: '',
| name: '',
| type: 'text',
| password: false,
| placeholder: '',
| placeholderClass: '',
| placeholderStyle: '',
| disabled: false,
| maxlength: 140,
| focus: false,
| clear: true,
| // 默认有清除功能
| syncInput: false,
| enableNative: false,
| // 兼容安卓input的输入bug
| onInput: function onInput() {},
| onConfirm: function onConfirm() {},
| onFocus: function onFocus() {},
| onBlur: function onBlur() {},
| onClear: function onClear() {},
| layer: '',
| // 表单排列位置,当为空时默认横向排列, vertical 为竖向排列
| controlled: false
| },
| data: {
| _focus: false,
| iconSize: fmtUnit(18)
| },
| didMount: function didMount() {
| this.setData({
| _focus: this.props.focus
| });
| },
| methods: {
| onBlur: function onBlur(e) {
| this.setData({
| _focus: false
| });
| var event = fmtEvent(this.props, e);
| this.props.onBlur(event);
| },
| onConfirm: function onConfirm(e) {
| var event = fmtEvent(this.props, e);
| this.props.onConfirm(event);
| },
| onFocus: function onFocus(e) {
| this.setData({
| _focus: true
| });
| var event = fmtEvent(this.props, e);
| this.props.onFocus(event);
| },
| onInput: function onInput(e) {
| var event = fmtEvent(this.props, e);
| this.props.onInput(event);
| },
| onClear: function onClear(e) {
| var event = fmtEvent(this.props, e);
| this.props.onClear(event);
| }
| }
| });
|
|