@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="cv-radio-opt-base">
|
|
3
3
|
<label class="cv-radio-opt__label">
|
|
4
|
-
<radio :value="localVal" :checked="
|
|
4
|
+
<radio :value="localVal" :checked="localChecked" style="transform: scale(0.7)" />
|
|
5
5
|
<view>
|
|
6
6
|
<slot>{{ label }}</slot>
|
|
7
7
|
</view>
|
|
@@ -27,18 +27,52 @@ export default {
|
|
|
27
27
|
},
|
|
28
28
|
data() {
|
|
29
29
|
return {
|
|
30
|
-
localVal: ''
|
|
30
|
+
localVal: '',
|
|
31
|
+
localChecked: false,
|
|
32
|
+
parentObj: null
|
|
31
33
|
};
|
|
32
34
|
},
|
|
33
35
|
watch: {
|
|
34
36
|
value(newVal) {
|
|
35
37
|
this.localVal = String(newVal);
|
|
38
|
+
},
|
|
39
|
+
checked(newVal) {
|
|
40
|
+
this.localChecked = newVal;
|
|
41
|
+
},
|
|
42
|
+
'parentObj.localVal'(newVal) {
|
|
43
|
+
// console.log('----', newVal);
|
|
44
|
+
this.localChecked = newVal == this.value ? true : false;
|
|
36
45
|
}
|
|
37
46
|
},
|
|
38
47
|
created() {
|
|
39
48
|
this.localVal = String(this.value);
|
|
49
|
+
this.localChecked = this.checked;
|
|
50
|
+
},
|
|
51
|
+
mounted() {
|
|
52
|
+
this.parentObj = this.getParent();
|
|
40
53
|
},
|
|
41
|
-
methods: {
|
|
54
|
+
methods: {
|
|
55
|
+
funcOnClick() {
|
|
56
|
+
// let parentObj = this.getParent();
|
|
57
|
+
// console.log(parentObj.$children);
|
|
58
|
+
// let { value } = parentObj;
|
|
59
|
+
// console.log(value, this.localVal);
|
|
60
|
+
// this.localChecked = newVal == this.value ? true : false;
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* 获取父元素实例
|
|
64
|
+
*/
|
|
65
|
+
getParent(name = 'cvRadioGroup') {
|
|
66
|
+
let parent = this.$parent;
|
|
67
|
+
let parentName = parent.$options.name;
|
|
68
|
+
while (parentName !== name) {
|
|
69
|
+
parent = parent.$parent;
|
|
70
|
+
if (!parent) return false;
|
|
71
|
+
parentName = parent.$options.name;
|
|
72
|
+
}
|
|
73
|
+
return parent;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
42
76
|
};
|
|
43
77
|
</script>
|
|
44
78
|
|
|
@@ -25,6 +25,15 @@ export default {
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
props: {
|
|
28
|
+
// 当前评分
|
|
29
|
+
value: {
|
|
30
|
+
type: [Number, String],
|
|
31
|
+
default: 1
|
|
32
|
+
},
|
|
33
|
+
modelValue: {
|
|
34
|
+
type: [Number, String],
|
|
35
|
+
default: 1
|
|
36
|
+
},
|
|
28
37
|
isFill: {
|
|
29
38
|
// 星星的类型,是否镂空
|
|
30
39
|
type: [Boolean, String],
|
|
@@ -45,11 +54,6 @@ export default {
|
|
|
45
54
|
type: [Number, String],
|
|
46
55
|
default: 24
|
|
47
56
|
},
|
|
48
|
-
value: {
|
|
49
|
-
// 当前评分
|
|
50
|
-
type: [Number, String],
|
|
51
|
-
default: 1
|
|
52
|
-
},
|
|
53
57
|
max: {
|
|
54
58
|
// 最大评分
|
|
55
59
|
type: [Number, String],
|
|
@@ -97,6 +101,7 @@ export default {
|
|
|
97
101
|
let value = e.target.dataset.value;
|
|
98
102
|
this.locaValue = value;
|
|
99
103
|
this.$emit('input', value);
|
|
104
|
+
this.$emit('update:modelValue', value);
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
107
|
};
|
|
@@ -39,7 +39,11 @@ export default {
|
|
|
39
39
|
},
|
|
40
40
|
props: {
|
|
41
41
|
value: {
|
|
42
|
-
type: String,
|
|
42
|
+
type: [Number, String],
|
|
43
|
+
default: ''
|
|
44
|
+
},
|
|
45
|
+
modelValue: {
|
|
46
|
+
type: [Number, String],
|
|
43
47
|
default: ''
|
|
44
48
|
},
|
|
45
49
|
placeholder: {
|
|
@@ -72,6 +76,7 @@ export default {
|
|
|
72
76
|
/* 判断是否禁止实时更新父级数据 */
|
|
73
77
|
if (this.disableRealTime === false) {
|
|
74
78
|
this.$emit('input', this.localVal);
|
|
79
|
+
this.$emit('update:modelValue', this.localVal);
|
|
75
80
|
}
|
|
76
81
|
},
|
|
77
82
|
onEmpty() {
|
|
@@ -81,6 +86,7 @@ export default {
|
|
|
81
86
|
onSearch() {
|
|
82
87
|
this.$emit('search', this.localVal);
|
|
83
88
|
this.$emit('input', this.localVal);
|
|
89
|
+
this.$emit('update:modelValue', this.localVal);
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
};
|
|
@@ -13,14 +13,17 @@ export default {
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
props: {
|
|
16
|
+
value: {
|
|
17
|
+
type: [Number, String, Boolean],
|
|
18
|
+
default: 0
|
|
19
|
+
},
|
|
20
|
+
modelValue: {
|
|
21
|
+
type: [Number, String, Boolean],
|
|
22
|
+
default: 0
|
|
23
|
+
},
|
|
16
24
|
disabled: {
|
|
17
25
|
type: Boolean,
|
|
18
26
|
default: false
|
|
19
|
-
},
|
|
20
|
-
//默认输入框内容
|
|
21
|
-
value: {
|
|
22
|
-
type: [String, Number, Boolean],
|
|
23
|
-
default: 0
|
|
24
27
|
}
|
|
25
28
|
},
|
|
26
29
|
data() {
|
|
@@ -33,29 +36,40 @@ export default {
|
|
|
33
36
|
},
|
|
34
37
|
watch: {
|
|
35
38
|
value(newVal) {
|
|
39
|
+
this.localVal = newVal;
|
|
40
|
+
this._dealDataList();
|
|
41
|
+
},
|
|
42
|
+
modelValue(newVal) {
|
|
43
|
+
this.localVal = newVal;
|
|
36
44
|
this._dealDataList();
|
|
37
45
|
}
|
|
38
46
|
},
|
|
39
47
|
created() {
|
|
48
|
+
this.localVal = this.doValueGet();
|
|
40
49
|
this._dealDataList();
|
|
41
50
|
},
|
|
42
51
|
methods: {
|
|
52
|
+
doValueGet() {
|
|
53
|
+
if (this.value === '') return this.modelValue;
|
|
54
|
+
if (this.modelValue === '') return this.value;
|
|
55
|
+
return this.value;
|
|
56
|
+
},
|
|
43
57
|
/* 整理数据 */
|
|
44
58
|
_dealDataList() {
|
|
45
|
-
this.dataType = typeof this.
|
|
59
|
+
this.dataType = typeof this.localVal;
|
|
46
60
|
switch (this.dataType) {
|
|
47
61
|
case 'boolean':
|
|
48
|
-
this.checked = this.
|
|
62
|
+
this.checked = this.localVal;
|
|
49
63
|
break;
|
|
50
64
|
case 'number':
|
|
51
|
-
if (this.
|
|
65
|
+
if (this.localVal === 1) {
|
|
52
66
|
this.checked = true;
|
|
53
67
|
} else {
|
|
54
68
|
this.checked = false;
|
|
55
69
|
}
|
|
56
70
|
break;
|
|
57
71
|
case 'string':
|
|
58
|
-
if (this.
|
|
72
|
+
if (this.localVal === '1') {
|
|
59
73
|
this.checked = true;
|
|
60
74
|
} else {
|
|
61
75
|
this.checked = false;
|
|
@@ -88,6 +102,7 @@ export default {
|
|
|
88
102
|
break;
|
|
89
103
|
}
|
|
90
104
|
this.$emit('input', this.localVal);
|
|
105
|
+
this.$emit('update:modelValue', this.localVal);
|
|
91
106
|
}
|
|
92
107
|
}
|
|
93
108
|
};
|
|
@@ -33,17 +33,21 @@ export default {
|
|
|
33
33
|
},
|
|
34
34
|
props: {
|
|
35
35
|
value: {
|
|
36
|
-
type: String,
|
|
36
|
+
type: [Number, String],
|
|
37
37
|
default: ''
|
|
38
38
|
},
|
|
39
|
-
|
|
39
|
+
modelValue: {
|
|
40
40
|
type: [Number, String],
|
|
41
|
-
default:
|
|
41
|
+
default: ''
|
|
42
42
|
},
|
|
43
43
|
placeholder: {
|
|
44
44
|
type: [String],
|
|
45
45
|
default: '请输入文本'
|
|
46
46
|
},
|
|
47
|
+
maxlength: {
|
|
48
|
+
type: [Number, String],
|
|
49
|
+
default: -1
|
|
50
|
+
},
|
|
47
51
|
clearable: {
|
|
48
52
|
type: Boolean,
|
|
49
53
|
default: false
|
|
@@ -53,7 +57,6 @@ export default {
|
|
|
53
57
|
default: true
|
|
54
58
|
}
|
|
55
59
|
},
|
|
56
|
-
|
|
57
60
|
data() {
|
|
58
61
|
return {
|
|
59
62
|
localVal: '',
|
|
@@ -64,15 +67,25 @@ export default {
|
|
|
64
67
|
value(newVal) {
|
|
65
68
|
this.localVal = newVal;
|
|
66
69
|
this.tempLength = this.localVal.length;
|
|
70
|
+
},
|
|
71
|
+
modelValue(newVal) {
|
|
72
|
+
this.localVal = newVal;
|
|
73
|
+
this.tempLength = this.localVal.length;
|
|
67
74
|
}
|
|
68
75
|
},
|
|
69
76
|
created() {
|
|
70
|
-
this.localVal = this.
|
|
77
|
+
this.localVal = this.doValueGet();
|
|
71
78
|
},
|
|
72
79
|
methods: {
|
|
80
|
+
doValueGet() {
|
|
81
|
+
if (this.value === '') return this.modelValue;
|
|
82
|
+
if (this.modelValue === '') return this.value;
|
|
83
|
+
return this.value;
|
|
84
|
+
},
|
|
73
85
|
funcOnInput(e) {
|
|
74
86
|
this.tempLength = this.localVal.length;
|
|
75
87
|
this.$emit('input', this.localVal);
|
|
88
|
+
this.$emit('update:modelValue', this.localVal);
|
|
76
89
|
},
|
|
77
90
|
/* 监听自己清除按钮点击事件 */
|
|
78
91
|
onEmpty() {
|
|
@@ -17,9 +17,7 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script>
|
|
20
|
-
import MixinsPicker from '../mixins/mixins-picker.js';
|
|
21
20
|
export default {
|
|
22
|
-
mixins: [MixinsPicker],
|
|
23
21
|
name: 'cvPickerTime',
|
|
24
22
|
props: {
|
|
25
23
|
//默认输入框
|
|
@@ -27,6 +25,10 @@ export default {
|
|
|
27
25
|
type: String,
|
|
28
26
|
default: ''
|
|
29
27
|
},
|
|
28
|
+
modelValue: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
30
32
|
startTime: {
|
|
31
33
|
type: String,
|
|
32
34
|
default: ''
|
|
@@ -34,6 +36,19 @@ export default {
|
|
|
34
36
|
endTime: {
|
|
35
37
|
type: String,
|
|
36
38
|
default: ''
|
|
39
|
+
},
|
|
40
|
+
// 占位符
|
|
41
|
+
placeholder: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '请选择'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
watch: {
|
|
47
|
+
value(newVal) {
|
|
48
|
+
this.localVal = newVal;
|
|
49
|
+
},
|
|
50
|
+
modelValue(newVal) {
|
|
51
|
+
this.localVal = newVal;
|
|
37
52
|
}
|
|
38
53
|
},
|
|
39
54
|
data() {
|
|
@@ -43,13 +58,25 @@ export default {
|
|
|
43
58
|
};
|
|
44
59
|
},
|
|
45
60
|
created() {
|
|
46
|
-
this.localVal = this.
|
|
61
|
+
this.localVal = this.doValueGet();
|
|
47
62
|
},
|
|
48
63
|
methods: {
|
|
64
|
+
doValueGet() {
|
|
65
|
+
if (this.value === '') return this.modelValue;
|
|
66
|
+
if (this.modelValue === '') return this.value;
|
|
67
|
+
return this.value;
|
|
68
|
+
},
|
|
49
69
|
bindTimeChange: function (e) {
|
|
50
70
|
this.localVal = e.detail.value;
|
|
71
|
+
this.iconTop = false;
|
|
51
72
|
this.$emit('input', this.localVal);
|
|
73
|
+
this.$emit('update:modelValue', this.localVal);
|
|
74
|
+
},
|
|
75
|
+
bindPickerCancel() {
|
|
52
76
|
this.iconTop = false;
|
|
77
|
+
},
|
|
78
|
+
changeIconTop() {
|
|
79
|
+
this.iconTop = true;
|
|
53
80
|
}
|
|
54
81
|
}
|
|
55
82
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<view class="cv-treaty-item">
|
|
4
4
|
<label class="cv-treaty-label">
|
|
5
5
|
<checkbox-group class="cv-treaty-item-group" @change="hindChange">
|
|
6
|
-
<checkbox value="true" :checked="
|
|
6
|
+
<checkbox value="true" :checked="localVal" :disabled="disabled" style="transform: scale(0.7)" />
|
|
7
7
|
{{ explain }}
|
|
8
8
|
</checkbox-group>
|
|
9
9
|
</label>
|
|
@@ -18,6 +18,18 @@
|
|
|
18
18
|
export default {
|
|
19
19
|
name: 'cvTreaty',
|
|
20
20
|
props: {
|
|
21
|
+
value: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
25
|
+
modelValue: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
21
33
|
explain: {
|
|
22
34
|
type: String,
|
|
23
35
|
default: '我已阅读'
|
|
@@ -29,28 +41,21 @@ export default {
|
|
|
29
41
|
url: {
|
|
30
42
|
type: String,
|
|
31
43
|
default: ''
|
|
32
|
-
},
|
|
33
|
-
value: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: false
|
|
36
|
-
},
|
|
37
|
-
disabled: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: false
|
|
40
44
|
}
|
|
41
45
|
},
|
|
42
46
|
data() {
|
|
43
47
|
return {
|
|
44
|
-
|
|
48
|
+
localVal: false
|
|
45
49
|
};
|
|
46
50
|
},
|
|
47
51
|
created() {
|
|
48
|
-
this.
|
|
52
|
+
this.localVal = this.value;
|
|
49
53
|
},
|
|
50
54
|
methods: {
|
|
51
55
|
hindChange(e) {
|
|
52
|
-
this.
|
|
53
|
-
this.$emit('input', this.
|
|
56
|
+
this.localVal = e.detail.value[0] ? true : false;
|
|
57
|
+
this.$emit('input', this.localVal);
|
|
58
|
+
this.$emit('update:modelValue', this.localVal);
|
|
54
59
|
},
|
|
55
60
|
handleClick() {
|
|
56
61
|
if (this.url) {
|
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
export default {
|
|
11
11
|
name: 'cvUploadAvatar',
|
|
12
12
|
props: {
|
|
13
|
+
value: {
|
|
14
|
+
type: [Number, String],
|
|
15
|
+
default: ''
|
|
16
|
+
},
|
|
17
|
+
modelValue: {
|
|
18
|
+
type: [Number, String],
|
|
19
|
+
default: ''
|
|
20
|
+
},
|
|
13
21
|
label: {
|
|
14
22
|
type: String,
|
|
15
23
|
default: '当前头像'
|
|
@@ -19,11 +27,6 @@ export default {
|
|
|
19
27
|
type: String,
|
|
20
28
|
default: '请输入'
|
|
21
29
|
},
|
|
22
|
-
//默认输入框
|
|
23
|
-
value: {
|
|
24
|
-
type: [Number, String],
|
|
25
|
-
default: ''
|
|
26
|
-
},
|
|
27
30
|
maxlength: {
|
|
28
31
|
type: [Number, String],
|
|
29
32
|
default: -1
|
|
@@ -55,6 +58,9 @@ export default {
|
|
|
55
58
|
value(newVal) {
|
|
56
59
|
this.localVal = newVal;
|
|
57
60
|
},
|
|
61
|
+
modelValue(newVal) {
|
|
62
|
+
this.localVal = newVal;
|
|
63
|
+
},
|
|
58
64
|
src(newVal) {
|
|
59
65
|
this.localSrc = newVal;
|
|
60
66
|
}
|
|
@@ -96,6 +102,7 @@ export default {
|
|
|
96
102
|
this.localVal = resData.save_url;
|
|
97
103
|
this.localSrc = resData.img_cdn;
|
|
98
104
|
this.$emit('input', this.localVal);
|
|
105
|
+
this.$emit('update:modelValue', this.localVal);
|
|
99
106
|
}
|
|
100
107
|
});
|
|
101
108
|
}
|
|
@@ -80,6 +80,18 @@ export default {
|
|
|
80
80
|
name: 'cvUploadImg',
|
|
81
81
|
components: {},
|
|
82
82
|
props: {
|
|
83
|
+
value: {
|
|
84
|
+
type: [Array, Object, String],
|
|
85
|
+
default() {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
modelValue: {
|
|
90
|
+
type: [Array, Object, String],
|
|
91
|
+
default() {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
},
|
|
83
95
|
uploadTitle: {
|
|
84
96
|
type: [String],
|
|
85
97
|
default: ''
|
|
@@ -100,12 +112,6 @@ export default {
|
|
|
100
112
|
}
|
|
101
113
|
},
|
|
102
114
|
//默认输入框
|
|
103
|
-
value: {
|
|
104
|
-
type: [Array, Object, String],
|
|
105
|
-
default() {
|
|
106
|
-
return [];
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
115
|
src: {
|
|
110
116
|
type: [Array, Object, String],
|
|
111
117
|
default(newVal) {
|
|
@@ -165,6 +171,9 @@ export default {
|
|
|
165
171
|
value(newVal) {
|
|
166
172
|
this.localVal = newVal;
|
|
167
173
|
},
|
|
174
|
+
modelValue(newVal) {
|
|
175
|
+
this.localVal = newVal;
|
|
176
|
+
},
|
|
168
177
|
src(newVal) {
|
|
169
178
|
this.localSrc = this._dealSrc(newVal);
|
|
170
179
|
this._dealNum();
|
|
@@ -309,8 +318,9 @@ export default {
|
|
|
309
318
|
this.localSrc.push(resData.img_cdn);
|
|
310
319
|
this.localVal = resData.img_time;
|
|
311
320
|
}
|
|
312
|
-
this.$emit('input', this.localVal);
|
|
313
321
|
// this.$forceUpdate();
|
|
322
|
+
this.$emit('input', this.localVal);
|
|
323
|
+
this.$emit('update:modelValue', this.localVal);
|
|
314
324
|
})
|
|
315
325
|
.catch((err) => {
|
|
316
326
|
uni.hideLoading();
|
|
@@ -350,6 +360,7 @@ export default {
|
|
|
350
360
|
return new Promise((resolve, reject) => {
|
|
351
361
|
this._chooseImage();
|
|
352
362
|
// this.$emit('input', this.localVal);
|
|
363
|
+
// this.$emit('update:modelValue', this.localVal);
|
|
353
364
|
});
|
|
354
365
|
}
|
|
355
366
|
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="cv-code-area">
|
|
3
|
-
<view class="cv-code-input-area" v-bind:style="inputAreaStyle">
|
|
4
|
-
<input
|
|
5
|
-
class="cv-code-input-item"
|
|
6
|
-
placeholder-class="cv-code-input-item-placeholder"
|
|
7
|
-
v-model="localVal"
|
|
8
|
-
:maxlength="maxlength"
|
|
9
|
-
:placeholder="placeholder"
|
|
10
|
-
@input="funcOnInput"
|
|
11
|
-
@blur="onBlur"
|
|
12
|
-
/>
|
|
13
|
-
</view>
|
|
14
|
-
<view class="cv-code-button-area" v-bind:style="buttonAreaStyle">
|
|
15
|
-
<button
|
|
16
|
-
size="mini"
|
|
17
|
-
class="cv-code-button-item"
|
|
18
|
-
:class="btnDisabled ? 'cv-code-button-wait' : ''"
|
|
19
|
-
:disabled="btnDisabled"
|
|
20
|
-
@tap="click"
|
|
21
|
-
>
|
|
22
|
-
{{ btnText }}
|
|
23
|
-
</button>
|
|
24
|
-
</view>
|
|
25
|
-
</view>
|
|
26
|
-
</template>
|
|
27
|
-
<script>
|
|
28
|
-
export default {
|
|
29
|
-
name: 'cvInputBtn',
|
|
30
|
-
inject: {
|
|
31
|
-
cvFormGroup: {
|
|
32
|
-
default() {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
props: {
|
|
38
|
-
placeholder: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: ''
|
|
41
|
-
},
|
|
42
|
-
maxlength: {
|
|
43
|
-
type: [Number, String],
|
|
44
|
-
default: -1
|
|
45
|
-
},
|
|
46
|
-
value: {
|
|
47
|
-
type: [Number, String],
|
|
48
|
-
default: ''
|
|
49
|
-
},
|
|
50
|
-
btnText: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: '发送'
|
|
53
|
-
},
|
|
54
|
-
btnWidth: {
|
|
55
|
-
type: Number,
|
|
56
|
-
default: 80
|
|
57
|
-
},
|
|
58
|
-
btnDisabled: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: false
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
data() {
|
|
64
|
-
return {
|
|
65
|
-
localVal: '',
|
|
66
|
-
buttonAreaStyle: '',
|
|
67
|
-
inputAreaStyle: ''
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
watch: {
|
|
71
|
-
value(newVal) {
|
|
72
|
-
this.localVal = newVal;
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
created() {
|
|
76
|
-
this.localVal = this.value;
|
|
77
|
-
this._initStyle();
|
|
78
|
-
},
|
|
79
|
-
methods: {
|
|
80
|
-
click(e) {
|
|
81
|
-
if (this.btnDisabled) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
this.$emit('click', e);
|
|
85
|
-
},
|
|
86
|
-
funcOnInput(e) {
|
|
87
|
-
this.$emit('input', this.localVal);
|
|
88
|
-
},
|
|
89
|
-
_initStyle() {
|
|
90
|
-
this.buttonAreaStyle = 'width:' + this.btnWidth + 'px;';
|
|
91
|
-
this.inputAreaStyle = 'width:calc(100% - ' + this.btnWidth + 'px - 10px);';
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
</script>
|
|
96
|
-
|
|
97
|
-
<style>
|
|
98
|
-
.cv-code-area {
|
|
99
|
-
height: 36px;
|
|
100
|
-
display: flex;
|
|
101
|
-
justify-content: space-evenly;
|
|
102
|
-
align-items: center;
|
|
103
|
-
flex-direction: row;
|
|
104
|
-
}
|
|
105
|
-
.cv-code-input-area {
|
|
106
|
-
width: calc(100% - 80px - 10px);
|
|
107
|
-
}
|
|
108
|
-
.cv-code-input-item {
|
|
109
|
-
height: 35px;
|
|
110
|
-
/* line-height: 35px; */
|
|
111
|
-
}
|
|
112
|
-
.cv-code-input-item-placeholder {
|
|
113
|
-
font-size: 12px;
|
|
114
|
-
}
|
|
115
|
-
.cv-code-button-area {
|
|
116
|
-
width: 80px;
|
|
117
|
-
display: flex;
|
|
118
|
-
}
|
|
119
|
-
.cv-code-button-item {
|
|
120
|
-
font-size: 12px;
|
|
121
|
-
background-color: #007aff;
|
|
122
|
-
color: #ffffff;
|
|
123
|
-
}
|
|
124
|
-
</style>
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
let MixinsInput = {
|
|
2
|
-
mixins: [],
|
|
3
|
-
inject: {
|
|
4
|
-
cvFormGroup: {
|
|
5
|
-
default() {
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
props: {
|
|
11
|
-
value: {
|
|
12
|
-
type: [Number, String],
|
|
13
|
-
default: ''
|
|
14
|
-
},
|
|
15
|
-
placeholder: {
|
|
16
|
-
type: [String],
|
|
17
|
-
default: '请输入'
|
|
18
|
-
},
|
|
19
|
-
clearable: {
|
|
20
|
-
type: [Boolean],
|
|
21
|
-
default: false
|
|
22
|
-
},
|
|
23
|
-
maxlength: {
|
|
24
|
-
type: [Number, String],
|
|
25
|
-
default: -1
|
|
26
|
-
},
|
|
27
|
-
disabled: {
|
|
28
|
-
type: [Boolean],
|
|
29
|
-
default: false
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
watch: {
|
|
33
|
-
value(newVal) {
|
|
34
|
-
this.localVal = newVal;
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
data() {
|
|
38
|
-
return {
|
|
39
|
-
localStyle: '',
|
|
40
|
-
localVal: ''
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
created() {
|
|
44
|
-
this.localVal = this.value;
|
|
45
|
-
},
|
|
46
|
-
mounted() {
|
|
47
|
-
this._itemStyle();
|
|
48
|
-
},
|
|
49
|
-
methods: {
|
|
50
|
-
_itemStyle() {
|
|
51
|
-
/* 计算输入框右侧预留空间 */
|
|
52
|
-
let paddingRight = 0;
|
|
53
|
-
if (this.$slots['append']) {
|
|
54
|
-
paddingRight += 20;
|
|
55
|
-
}
|
|
56
|
-
if (this.clearable) {
|
|
57
|
-
paddingRight += 30;
|
|
58
|
-
}
|
|
59
|
-
this.localStyle = 'margin-right:' + paddingRight + 'px;';
|
|
60
|
-
},
|
|
61
|
-
onBlur(e) {
|
|
62
|
-
this.localVal = e.detail.value;
|
|
63
|
-
this.funcOnInput();
|
|
64
|
-
},
|
|
65
|
-
funcOnInput(e) {
|
|
66
|
-
this.$emit('input', this.localVal);
|
|
67
|
-
},
|
|
68
|
-
/* 监听自己清除按钮点击事件 */
|
|
69
|
-
onEmpty() {
|
|
70
|
-
this.localVal = '';
|
|
71
|
-
this.funcOnInput();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
export default MixinsInput;
|