index.js
2.9 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var utils_1 = require("../common/utils");
component_1.VantComponent({
field: true,
classes: ['input-class', 'right-icon-class'],
props: {
size: String,
icon: String,
label: String,
error: Boolean,
fixed: Boolean,
focus: Boolean,
center: Boolean,
isLink: Boolean,
leftIcon: String,
rightIcon: String,
disabled: Boolean,
autosize: Boolean,
readonly: Boolean,
required: Boolean,
password: Boolean,
iconClass: String,
clearable: Boolean,
inputAlign: String,
customStyle: String,
confirmType: String,
confirmHold: Boolean,
errorMessage: String,
placeholder: String,
placeholderStyle: String,
errorMessageAlign: String,
selectionEnd: {
type: Number,
value: -1
},
selectionStart: {
type: Number,
value: -1
},
showConfirmBar: {
type: Boolean,
value: true
},
adjustPosition: {
type: Boolean,
value: true
},
cursorSpacing: {
type: Number,
value: 50
},
maxlength: {
type: Number,
value: -1
},
type: {
type: String,
value: 'text'
},
border: {
type: Boolean,
value: true
},
titleWidth: {
type: String,
value: '90px'
}
},
data: {
focused: false,
system: utils_1.getSystemInfoSync().system.split(' ').shift().toLowerCase()
},
methods: {
onInput: function (event) {
var _this = this;
var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
this.set({ value: value }, function () {
_this.emitChange(value);
});
},
onFocus: function (event) {
this.set({ focused: true });
this.$emit('focus', event.detail);
},
onBlur: function (event) {
this.set({ focused: false });
this.$emit('blur', event.detail);
},
onClickIcon: function () {
this.$emit('click-icon');
},
onClear: function () {
var _this = this;
this.set({ value: '' }, function () {
_this.emitChange('');
_this.$emit('clear', '');
});
},
onConfirm: function () {
this.$emit('confirm', this.data.value);
},
emitChange: function (value) {
this.$emit('input', value);
this.$emit('change', value);
}
}
});