@10yun/cv-mobile-ui 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/ui-cv/{cv-button/cv-button.vue → cv-btn-base/cv-btn-base.vue} +19 -14
- package/ui-cv/cv-checkbox-group/cv-checkbox-group.vue +89 -56
- package/ui-cv/cv-checkbox-opt-base/cv-checkbox-opt-base.vue +43 -3
- package/ui-cv/cv-checkbox-opt-tag/cv-checkbox-opt-tag.vue +6 -2
- package/ui-cv/cv-code-sms/cv-code-sms.vue +6 -4
- package/ui-cv/cv-date-base/cv-date-base.vue +27 -6
- package/ui-cv/cv-datetime-base/cv-datetime-base.vue +15 -5
- package/ui-cv/cv-datetime5-base/cv-datetime5-base.vue +24 -7
- package/ui-cv/cv-dialog-share/cv-dialog-share.vue +2 -0
- package/ui-cv/cv-editor-quill/cv-editor-quill.vue +1 -0
- package/ui-cv/cv-form-base/cv-form-base.vue +1 -1
- package/ui-cv/cv-form-item/cv-form-item.vue +5 -2
- package/ui-cv/cv-geo-local/cv-geo-local.vue +118 -27
- package/ui-cv/{cv-picker-region/cv-picker-region.vue → cv-geo-region/cv-geo-region.vue} +30 -8
- package/ui-cv/cv-input-digit/cv-input-digit.vue +69 -6
- package/ui-cv/cv-input-idcard/cv-input-idcard.vue +70 -7
- package/ui-cv/cv-input-number/cv-input-number.vue +56 -6
- package/ui-cv/cv-input-password/cv-input-password.vue +66 -5
- package/ui-cv/cv-input-text/cv-input-text.vue +74 -7
- package/ui-cv/cv-picker1/cv-picker1.vue +28 -4
- package/ui-cv/cv-picker2/cv-picker2.vue +34 -11
- package/ui-cv/cv-picker3/cv-picker3.vue +41 -16
- package/ui-cv/cv-radio-group/cv-radio-group.vue +35 -13
- package/ui-cv/cv-radio-opt-base/cv-radio-opt-base.vue +37 -3
- package/ui-cv/cv-radio-opt-tag/cv-radio-opt-tag.vue +1 -1
- package/ui-cv/cv-rate/cv-rate.vue +10 -5
- package/ui-cv/cv-search/cv-search.vue +7 -1
- package/ui-cv/cv-switch/cv-switch.vue +24 -9
- package/ui-cv/cv-textarea/cv-textarea.vue +18 -5
- package/ui-cv/cv-time-base/cv-time-base.vue +30 -3
- package/ui-cv/cv-treaty/cv-treaty.vue +18 -13
- package/ui-cv/cv-upload-avatar/cv-upload-avatar.vue +12 -5
- package/ui-cv/cv-upload-image/cv-upload-image.vue +18 -7
- package/ui-cv/cv-input-btn/cv-input-btn.vue +0 -124
- package/ui-cv/mixins/mixins-input.js +0 -75
- package/ui-cv/mixins/mixins-picker.js +0 -34
|
@@ -451,7 +451,8 @@ export default {
|
|
|
451
451
|
align-items: center;
|
|
452
452
|
width: 65px;
|
|
453
453
|
padding: 5px 0;
|
|
454
|
-
height: 36px;
|
|
454
|
+
min-height: 36px;
|
|
455
|
+
font-weight: 500;
|
|
455
456
|
}
|
|
456
457
|
|
|
457
458
|
.cv-form-item__label .label-text {
|
|
@@ -467,11 +468,13 @@ export default {
|
|
|
467
468
|
/* #ifndef APP-NVUE */
|
|
468
469
|
width: 100%;
|
|
469
470
|
box-sizing: border-box;
|
|
470
|
-
min-height:
|
|
471
|
+
min-height: 40px;
|
|
471
472
|
/* #endif */
|
|
472
473
|
flex: 1;
|
|
473
474
|
display: flex;
|
|
474
475
|
align-items: center;
|
|
476
|
+
justify-content: space-between;
|
|
477
|
+
flex-direction: row;
|
|
475
478
|
}
|
|
476
479
|
|
|
477
480
|
.label-icon {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="cv-geo-local-wrap">
|
|
3
|
-
<view class="cv-geo-local" ref="onEmpty">
|
|
3
|
+
<view class="cv-geo-local-info" ref="onEmpty">
|
|
4
4
|
<textarea
|
|
5
|
-
class="cv-geo-local-
|
|
5
|
+
class="cv-geo-local-content"
|
|
6
6
|
v-model="localVal"
|
|
7
|
+
:value="localVal"
|
|
7
8
|
:maxlength="maxlength"
|
|
8
9
|
:placeholder="placeholder"
|
|
9
10
|
placeholder-class="cv-geo-local-placeholder"
|
|
@@ -16,41 +17,60 @@
|
|
|
16
17
|
</view>
|
|
17
18
|
<view class="cv-geo-local-map" v-if="isShowMap">
|
|
18
19
|
<map
|
|
19
|
-
style="width: 100%; height:
|
|
20
|
+
style="width: 100%; height: 170px"
|
|
20
21
|
:longitude="map_location.longitude"
|
|
21
22
|
:latitude="map_location.latitude"
|
|
22
|
-
:scale="
|
|
23
|
+
:scale="localScale"
|
|
23
24
|
show-location
|
|
24
25
|
:markers="markers"
|
|
25
26
|
></map>
|
|
26
27
|
</view>
|
|
27
28
|
</view>
|
|
28
29
|
</template>
|
|
29
|
-
|
|
30
30
|
<script>
|
|
31
|
-
import MixinsInput from '../mixins/mixins-input.js';
|
|
32
31
|
export default {
|
|
33
|
-
mixins: [MixinsInput],
|
|
34
32
|
name: 'cvGeoLocal',
|
|
35
33
|
options: {
|
|
36
34
|
addGlobalClass: true
|
|
37
35
|
},
|
|
38
36
|
props: {
|
|
37
|
+
value: {
|
|
38
|
+
type: [Number, String],
|
|
39
|
+
default: ''
|
|
40
|
+
},
|
|
41
|
+
modelValue: {
|
|
42
|
+
type: [Number, String],
|
|
43
|
+
default: ''
|
|
44
|
+
},
|
|
39
45
|
placeholder: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: '
|
|
46
|
+
type: [String],
|
|
47
|
+
default: '请输入定位地址'
|
|
48
|
+
},
|
|
49
|
+
disabled: {
|
|
50
|
+
type: [Boolean],
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
clearable: {
|
|
54
|
+
type: [Boolean],
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
maxlength: {
|
|
58
|
+
type: [Number, String],
|
|
59
|
+
default: 5
|
|
42
60
|
},
|
|
43
61
|
isShowMap: {
|
|
44
62
|
type: Boolean,
|
|
45
|
-
default
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
63
|
+
default: false
|
|
48
64
|
},
|
|
49
65
|
location: {
|
|
50
66
|
type: Object,
|
|
51
67
|
default() {
|
|
52
68
|
return {};
|
|
53
69
|
}
|
|
70
|
+
},
|
|
71
|
+
scale: {
|
|
72
|
+
type: [Number, String],
|
|
73
|
+
default: 14
|
|
54
74
|
}
|
|
55
75
|
},
|
|
56
76
|
watch: {
|
|
@@ -69,7 +89,15 @@ export default {
|
|
|
69
89
|
this.initLocation();
|
|
70
90
|
}
|
|
71
91
|
},
|
|
72
|
-
value(
|
|
92
|
+
value(newVal) {
|
|
93
|
+
this.localVal = newVal;
|
|
94
|
+
if (this.isShowMap) {
|
|
95
|
+
console.log('change:value');
|
|
96
|
+
this.initLocation();
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
modelValue(newVal) {
|
|
100
|
+
this.localVal = newVal;
|
|
73
101
|
if (this.isShowMap) {
|
|
74
102
|
console.log('change:value');
|
|
75
103
|
this.initLocation();
|
|
@@ -78,37 +106,92 @@ export default {
|
|
|
78
106
|
},
|
|
79
107
|
data() {
|
|
80
108
|
return {
|
|
109
|
+
localStyle: '',
|
|
110
|
+
localVal: '',
|
|
81
111
|
markers: [],
|
|
82
112
|
//当前选择的位置
|
|
83
|
-
|
|
113
|
+
localScale: 14,
|
|
84
114
|
map_location: {
|
|
85
|
-
longitude:
|
|
86
|
-
latitude:
|
|
87
|
-
}
|
|
115
|
+
longitude: 119.296411,
|
|
116
|
+
latitude: 26.074286
|
|
117
|
+
},
|
|
118
|
+
parentObj: null
|
|
88
119
|
};
|
|
89
120
|
},
|
|
90
121
|
created() {
|
|
122
|
+
this.localVal = this.doValueGet();
|
|
123
|
+
this.localScale = this.scale;
|
|
91
124
|
this.initLocation();
|
|
92
125
|
},
|
|
126
|
+
mounted() {
|
|
127
|
+
this.parentObj = this.getParent();
|
|
128
|
+
this._itemStyle();
|
|
129
|
+
console.log(this.parentObj);
|
|
130
|
+
},
|
|
93
131
|
methods: {
|
|
132
|
+
doValueGet() {
|
|
133
|
+
if (this.value === '') return this.modelValue;
|
|
134
|
+
if (this.modelValue === '') return this.value;
|
|
135
|
+
return this.value;
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
* 获取父元素实例
|
|
139
|
+
*/
|
|
140
|
+
getParent(name = 'cvFormItem') {
|
|
141
|
+
let parent = this.$parent;
|
|
142
|
+
let parentName = parent.$options.name;
|
|
143
|
+
while (parentName !== name) {
|
|
144
|
+
parent = parent.$parent;
|
|
145
|
+
if (!parent) return false;
|
|
146
|
+
parentName = parent.$options.name;
|
|
147
|
+
}
|
|
148
|
+
return parent;
|
|
149
|
+
},
|
|
150
|
+
_itemStyle() {
|
|
151
|
+
/**计算label宽度 */
|
|
152
|
+
let styleWidth = '';
|
|
153
|
+
if (this.parentObj.labelPosition) {
|
|
154
|
+
styleWidth = 'width:calc( 100% - 33px);';
|
|
155
|
+
} else {
|
|
156
|
+
let itemWidth = this.parentObj.labelWidth || 70;
|
|
157
|
+
styleWidth = `width:calc( 100% - 33px - ${itemWidth}px);`;
|
|
158
|
+
}
|
|
159
|
+
this.localStyle = styleWidth;
|
|
160
|
+
},
|
|
161
|
+
onBlur(e) {
|
|
162
|
+
this.localVal = e.detail.value;
|
|
163
|
+
this.funcOnInput();
|
|
164
|
+
},
|
|
165
|
+
funcOnInput(e) {
|
|
166
|
+
console.log('-----funcOnInput---', this.localVal);
|
|
167
|
+
this.$emit('input', this.localVal);
|
|
168
|
+
this.$emit('update:modelValue', this.localVal);
|
|
169
|
+
},
|
|
170
|
+
/* 监听自己清除按钮点击事件 */
|
|
171
|
+
onEmpty() {
|
|
172
|
+
this.localVal = '';
|
|
173
|
+
this.funcOnInput();
|
|
174
|
+
},
|
|
94
175
|
initLocation() {
|
|
95
176
|
if (this.location.longitude && this.location.latitude) {
|
|
96
177
|
this.map_location = this.location;
|
|
97
178
|
}
|
|
98
|
-
|
|
99
|
-
|
|
179
|
+
console.log('--', this.map_location);
|
|
180
|
+
if (this.localVal) {
|
|
181
|
+
this.$set(this.map_location, 'address', this.localVal);
|
|
100
182
|
}
|
|
101
183
|
},
|
|
102
184
|
chooseLocation() {
|
|
103
185
|
uni.chooseLocation({
|
|
104
186
|
keyword: '小区 写字楼', //搜索关键字,仅App平台支持
|
|
105
187
|
success: (res) => {
|
|
188
|
+
console.log(res);
|
|
106
189
|
if (res.errMsg == 'chooseLocation:ok') {
|
|
107
|
-
this.localVal = res.address;
|
|
190
|
+
this.localVal = res.address || '';
|
|
108
191
|
this.map_location = { ...res };
|
|
109
|
-
this.
|
|
192
|
+
this.localScale = 16;
|
|
110
193
|
this.$emit('location', { ...res });
|
|
111
|
-
this
|
|
194
|
+
this.funcOnInput();
|
|
112
195
|
}
|
|
113
196
|
}
|
|
114
197
|
});
|
|
@@ -138,9 +221,18 @@ export default {
|
|
|
138
221
|
<style>
|
|
139
222
|
.cv-geo-local-wrap {
|
|
140
223
|
display: contents;
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-direction: column;
|
|
226
|
+
width: 100%;
|
|
227
|
+
}
|
|
228
|
+
.cv-geo-local-info {
|
|
229
|
+
display: flex;
|
|
230
|
+
flex-direction: row;
|
|
231
|
+
justify-content: space-between;
|
|
232
|
+
align-items: center;
|
|
141
233
|
}
|
|
142
|
-
.cv-geo-local-
|
|
143
|
-
min-height:
|
|
234
|
+
.cv-geo-local-content {
|
|
235
|
+
min-height: 46px;
|
|
144
236
|
line-height: 1.5em;
|
|
145
237
|
font-size: 14px;
|
|
146
238
|
padding: 7px 30px 0 0;
|
|
@@ -148,8 +240,8 @@ export default {
|
|
|
148
240
|
}
|
|
149
241
|
.cv-geo-local-rtip {
|
|
150
242
|
color: #999;
|
|
151
|
-
width:
|
|
152
|
-
padding:
|
|
243
|
+
width: 25px;
|
|
244
|
+
padding: 5 0 5 0;
|
|
153
245
|
position: absolute;
|
|
154
246
|
right: 0;
|
|
155
247
|
top: -7px;
|
|
@@ -167,7 +259,6 @@ export default {
|
|
|
167
259
|
right: 3px;
|
|
168
260
|
}
|
|
169
261
|
.cv-geo-local-map {
|
|
170
|
-
padding: 10px 15px;
|
|
171
262
|
background-color: #ffffff;
|
|
172
263
|
}
|
|
173
264
|
</style>
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
</picker>
|
|
21
21
|
</view>
|
|
22
22
|
</template>
|
|
23
|
-
|
|
24
23
|
<script>
|
|
25
|
-
import MixinsPicker from '../mixins/mixins-picker.js';
|
|
26
24
|
import province from '../dict/area-province.js';
|
|
27
25
|
import city from '../dict/area-city.js';
|
|
28
26
|
import county from '../dict/area-county.js';
|
|
29
27
|
export default {
|
|
30
|
-
mixins: [MixinsPicker],
|
|
31
28
|
name: 'cvPickerRegion',
|
|
32
29
|
props: {
|
|
33
|
-
//默认输入框内容
|
|
34
30
|
value: {
|
|
35
|
-
type: Array,
|
|
36
|
-
default: () =>
|
|
31
|
+
type: [Array, Object],
|
|
32
|
+
default: () => []
|
|
33
|
+
},
|
|
34
|
+
modelValue: {
|
|
35
|
+
type: [Array, Object],
|
|
36
|
+
default: () => []
|
|
37
37
|
},
|
|
38
38
|
dataType: {
|
|
39
39
|
type: String,
|
|
@@ -42,18 +42,27 @@ export default {
|
|
|
42
42
|
joint: {
|
|
43
43
|
type: String,
|
|
44
44
|
default: ''
|
|
45
|
+
},
|
|
46
|
+
// 占位符
|
|
47
|
+
placeholder: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: '请选择'
|
|
45
50
|
}
|
|
46
51
|
},
|
|
47
52
|
watch: {
|
|
48
53
|
value(newVal) {
|
|
49
54
|
this.localVal = newVal;
|
|
50
55
|
this.itemsSortOut();
|
|
56
|
+
},
|
|
57
|
+
modelValue(newVal) {
|
|
58
|
+
this.localVal = newVal;
|
|
59
|
+
this.itemsSortOut();
|
|
51
60
|
}
|
|
52
61
|
},
|
|
53
62
|
data() {
|
|
54
63
|
return {
|
|
55
64
|
iconTop: false,
|
|
56
|
-
localVal:
|
|
65
|
+
localVal: [],
|
|
57
66
|
range_data: [], //弹窗临时数组
|
|
58
67
|
last_range_data: [], //最终显示页面数组
|
|
59
68
|
items_index: [0, 0, 0], //当前下标
|
|
@@ -67,11 +76,20 @@ export default {
|
|
|
67
76
|
};
|
|
68
77
|
},
|
|
69
78
|
created() {
|
|
70
|
-
this.localVal = this.
|
|
79
|
+
this.localVal = this.doValueGet();
|
|
71
80
|
this.localDataType = this.dataType != 'value' ? 'text' : 'value';
|
|
72
81
|
this.itemsSortOut();
|
|
73
82
|
},
|
|
74
83
|
methods: {
|
|
84
|
+
doValueGet() {
|
|
85
|
+
if (this.value === '' || (Array.prototype.isPrototypeOf(this.value) && this.value.length === 0)) {
|
|
86
|
+
return this.modelValue;
|
|
87
|
+
}
|
|
88
|
+
if (this.modelValue === '' || (Array.prototype.isPrototypeOf(this.modelValue) && this.modelValue.length === 0)) {
|
|
89
|
+
return this.value;
|
|
90
|
+
}
|
|
91
|
+
return this.value;
|
|
92
|
+
},
|
|
75
93
|
initReginData(data) {
|
|
76
94
|
let localData = [];
|
|
77
95
|
for (const key in data) {
|
|
@@ -137,6 +155,9 @@ export default {
|
|
|
137
155
|
this.updatelocalVal();
|
|
138
156
|
this.iconTop = false;
|
|
139
157
|
},
|
|
158
|
+
changeIconTop() {
|
|
159
|
+
this.iconTop = true;
|
|
160
|
+
},
|
|
140
161
|
/* 取消选择 */
|
|
141
162
|
onCancel(e) {
|
|
142
163
|
this.iconTop = false;
|
|
@@ -188,6 +209,7 @@ export default {
|
|
|
188
209
|
value[2] = this.range_data[2][items_index[2]].value;
|
|
189
210
|
}
|
|
190
211
|
this.$emit('input', value);
|
|
212
|
+
this.$emit('update:modelValue', value);
|
|
191
213
|
|
|
192
214
|
// 把选中的3个数组传递出去
|
|
193
215
|
|
|
@@ -24,9 +24,7 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
|
-
import MixinsInput from '../mixins/mixins-input.js';
|
|
28
27
|
export default {
|
|
29
|
-
mixins: [MixinsInput],
|
|
30
28
|
name: 'cvInputDigit',
|
|
31
29
|
inject: {
|
|
32
30
|
cvFormGroup: {
|
|
@@ -36,18 +34,83 @@ export default {
|
|
|
36
34
|
}
|
|
37
35
|
},
|
|
38
36
|
props: {
|
|
37
|
+
value: {
|
|
38
|
+
type: [Number, String],
|
|
39
|
+
default: ''
|
|
40
|
+
},
|
|
41
|
+
modelValue: {
|
|
42
|
+
type: [Number, String],
|
|
43
|
+
default: ''
|
|
44
|
+
},
|
|
39
45
|
placeholder: {
|
|
40
46
|
type: [String],
|
|
41
47
|
default: '请输入数字'
|
|
48
|
+
},
|
|
49
|
+
disabled: {
|
|
50
|
+
type: [Boolean],
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
clearable: {
|
|
54
|
+
type: [Boolean],
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
maxlength: {
|
|
58
|
+
type: [Number, String],
|
|
59
|
+
default: -1
|
|
42
60
|
}
|
|
43
61
|
},
|
|
44
62
|
// 监听动态数据变化
|
|
45
|
-
watch: {
|
|
63
|
+
watch: {
|
|
64
|
+
value(newVal) {
|
|
65
|
+
this.localVal = newVal;
|
|
66
|
+
},
|
|
67
|
+
modelValue(newVal) {
|
|
68
|
+
this.localVal = newVal;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
46
71
|
data() {
|
|
47
|
-
return {
|
|
72
|
+
return {
|
|
73
|
+
localStyle: '',
|
|
74
|
+
localVal: ''
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
created() {
|
|
78
|
+
this.localVal = this.doValueGet();
|
|
79
|
+
},
|
|
80
|
+
mounted() {
|
|
81
|
+
this._itemStyle();
|
|
48
82
|
},
|
|
49
|
-
|
|
50
|
-
|
|
83
|
+
methods: {
|
|
84
|
+
doValueGet() {
|
|
85
|
+
if (this.value === '') return this.modelValue;
|
|
86
|
+
if (this.modelValue === '') return this.value;
|
|
87
|
+
return this.value;
|
|
88
|
+
},
|
|
89
|
+
_itemStyle() {
|
|
90
|
+
/* 计算输入框右侧预留空间 */
|
|
91
|
+
let paddingRight = 0;
|
|
92
|
+
if (this.$slots['append']) {
|
|
93
|
+
paddingRight += 20;
|
|
94
|
+
}
|
|
95
|
+
if (this.clearable) {
|
|
96
|
+
paddingRight += 30;
|
|
97
|
+
}
|
|
98
|
+
this.localStyle = 'margin-right:' + paddingRight + 'px;';
|
|
99
|
+
},
|
|
100
|
+
onBlur(e) {
|
|
101
|
+
this.localVal = e.detail.value;
|
|
102
|
+
this.funcOnInput();
|
|
103
|
+
},
|
|
104
|
+
funcOnInput(e) {
|
|
105
|
+
this.$emit('input', this.localVal);
|
|
106
|
+
this.$emit('update:modelValue', this.localVal);
|
|
107
|
+
},
|
|
108
|
+
/* 监听自己清除按钮点击事件 */
|
|
109
|
+
onEmpty() {
|
|
110
|
+
this.localVal = '';
|
|
111
|
+
this.funcOnInput();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
51
114
|
};
|
|
52
115
|
</script>
|
|
53
116
|
<style>
|
|
@@ -20,9 +20,7 @@
|
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script>
|
|
23
|
-
import MixinsInput from '../mixins/mixins-input.js';
|
|
24
23
|
export default {
|
|
25
|
-
mixins: [MixinsInput],
|
|
26
24
|
name: 'cvInputIdcard',
|
|
27
25
|
inject: {
|
|
28
26
|
cvFormGroup: {
|
|
@@ -32,22 +30,87 @@ export default {
|
|
|
32
30
|
}
|
|
33
31
|
},
|
|
34
32
|
props: {
|
|
33
|
+
value: {
|
|
34
|
+
type: [Number, String],
|
|
35
|
+
default: ''
|
|
36
|
+
},
|
|
37
|
+
modelValue: {
|
|
38
|
+
type: [Number, String],
|
|
39
|
+
default: ''
|
|
40
|
+
},
|
|
35
41
|
placeholder: {
|
|
36
42
|
type: [String],
|
|
37
43
|
default: '请输入身份证'
|
|
44
|
+
},
|
|
45
|
+
disabled: {
|
|
46
|
+
type: [Boolean],
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
clearable: {
|
|
50
|
+
type: [Boolean],
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
maxlength: {
|
|
54
|
+
type: [Number, String],
|
|
55
|
+
default: -1
|
|
38
56
|
}
|
|
39
57
|
},
|
|
40
58
|
data() {
|
|
41
|
-
return {
|
|
59
|
+
return {
|
|
60
|
+
localStyle: '',
|
|
61
|
+
localVal: ''
|
|
62
|
+
};
|
|
42
63
|
},
|
|
43
|
-
watch: {
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
watch: {
|
|
65
|
+
value(newVal) {
|
|
66
|
+
this.localVal = newVal;
|
|
67
|
+
},
|
|
68
|
+
modelValue(newVal) {
|
|
69
|
+
this.localVal = newVal;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
created() {
|
|
73
|
+
this.localVal = this.doValueGet();
|
|
74
|
+
},
|
|
75
|
+
mounted() {
|
|
76
|
+
this._itemStyle();
|
|
77
|
+
},
|
|
78
|
+
methods: {
|
|
79
|
+
doValueGet() {
|
|
80
|
+
if (this.value === '') return this.modelValue;
|
|
81
|
+
if (this.modelValue === '') return this.value;
|
|
82
|
+
return this.value;
|
|
83
|
+
},
|
|
84
|
+
_itemStyle() {
|
|
85
|
+
/* 计算输入框右侧预留空间 */
|
|
86
|
+
let paddingRight = 0;
|
|
87
|
+
if (this.$slots['append']) {
|
|
88
|
+
paddingRight += 20;
|
|
89
|
+
}
|
|
90
|
+
if (this.clearable) {
|
|
91
|
+
paddingRight += 30;
|
|
92
|
+
}
|
|
93
|
+
this.localStyle = 'margin-right:' + paddingRight + 'px;';
|
|
94
|
+
},
|
|
95
|
+
onBlur(e) {
|
|
96
|
+
this.localVal = e.detail.value;
|
|
97
|
+
this.funcOnInput();
|
|
98
|
+
},
|
|
99
|
+
funcOnInput(e) {
|
|
100
|
+
this.$emit('input', this.localVal);
|
|
101
|
+
this.$emit('update:modelValue', this.localVal);
|
|
102
|
+
},
|
|
103
|
+
/* 监听自己清除按钮点击事件 */
|
|
104
|
+
onEmpty() {
|
|
105
|
+
this.localVal = '';
|
|
106
|
+
this.funcOnInput();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
46
109
|
};
|
|
47
110
|
</script>
|
|
48
111
|
<style>
|
|
49
112
|
.cv-input__content {
|
|
50
|
-
height: 36px;
|
|
113
|
+
min-height: 36px;
|
|
51
114
|
line-height: 36px;
|
|
52
115
|
font-size: 14px;
|
|
53
116
|
}
|
|
@@ -22,11 +22,8 @@
|
|
|
22
22
|
</view>
|
|
23
23
|
</view>
|
|
24
24
|
</template>
|
|
25
|
-
|
|
26
25
|
<script>
|
|
27
|
-
import MixinsInput from '../mixins/mixins-input.js';
|
|
28
26
|
export default {
|
|
29
|
-
mixins: [MixinsInput],
|
|
30
27
|
name: 'cvInputNumber',
|
|
31
28
|
inject: {
|
|
32
29
|
cvFormGroup: {
|
|
@@ -36,23 +33,76 @@ export default {
|
|
|
36
33
|
}
|
|
37
34
|
},
|
|
38
35
|
props: {
|
|
36
|
+
value: {
|
|
37
|
+
type: [Number, String],
|
|
38
|
+
default: ''
|
|
39
|
+
},
|
|
40
|
+
modelValue: {
|
|
41
|
+
type: [Number, String],
|
|
42
|
+
default: ''
|
|
43
|
+
},
|
|
39
44
|
placeholder: {
|
|
40
45
|
type: [String],
|
|
41
46
|
default: '请输入数字'
|
|
47
|
+
},
|
|
48
|
+
disabled: {
|
|
49
|
+
type: [Boolean],
|
|
50
|
+
default: false
|
|
51
|
+
},
|
|
52
|
+
clearable: {
|
|
53
|
+
type: [Boolean],
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
maxlength: {
|
|
57
|
+
type: [Number, String],
|
|
58
|
+
default: -1
|
|
42
59
|
}
|
|
43
60
|
},
|
|
44
61
|
data() {
|
|
45
|
-
return {
|
|
62
|
+
return {
|
|
63
|
+
localStyle: '',
|
|
64
|
+
localVal: ''
|
|
65
|
+
};
|
|
46
66
|
},
|
|
47
67
|
watch: {
|
|
48
68
|
value(newVal) {
|
|
49
69
|
this.localVal = this._dealValue(newVal);
|
|
70
|
+
},
|
|
71
|
+
modelValue(newVal) {
|
|
72
|
+
this.localVal = this._dealValue(newVal);
|
|
50
73
|
}
|
|
51
74
|
},
|
|
52
75
|
created() {
|
|
53
|
-
this.localVal = this._dealValue(this.value);
|
|
76
|
+
// this.localVal = this._dealValue(this.value);
|
|
77
|
+
},
|
|
78
|
+
mounted() {
|
|
79
|
+
this._itemStyle();
|
|
54
80
|
},
|
|
55
81
|
methods: {
|
|
82
|
+
_itemStyle() {
|
|
83
|
+
/* 计算输入框右侧预留空间 */
|
|
84
|
+
let paddingRight = 0;
|
|
85
|
+
if (this.$slots['append']) {
|
|
86
|
+
paddingRight += 20;
|
|
87
|
+
}
|
|
88
|
+
if (this.clearable) {
|
|
89
|
+
paddingRight += 30;
|
|
90
|
+
}
|
|
91
|
+
this.localStyle = 'margin-right:' + paddingRight + 'px;';
|
|
92
|
+
},
|
|
93
|
+
onBlur(e) {
|
|
94
|
+
this.localVal = e.detail.value;
|
|
95
|
+
this.funcOnInput();
|
|
96
|
+
},
|
|
97
|
+
funcOnInput(e) {
|
|
98
|
+
this.$emit('input', this.localVal);
|
|
99
|
+
this.$emit('update:modelValue', this.localVal);
|
|
100
|
+
},
|
|
101
|
+
/* 监听自己清除按钮点击事件 */
|
|
102
|
+
onEmpty() {
|
|
103
|
+
this.localVal = '';
|
|
104
|
+
this.funcOnInput();
|
|
105
|
+
},
|
|
56
106
|
_dealValue(value) {
|
|
57
107
|
if (Object.prototype.toString.call(value) === '[object Number]') {
|
|
58
108
|
return value.toString();
|
|
@@ -66,7 +116,7 @@ export default {
|
|
|
66
116
|
|
|
67
117
|
<style>
|
|
68
118
|
.cv-input__content {
|
|
69
|
-
height: 36px;
|
|
119
|
+
min-height: 36px;
|
|
70
120
|
line-height: 36px;
|
|
71
121
|
font-size: 14px;
|
|
72
122
|
}
|