@10yun/cv-mobile-ui 0.5.3 → 0.5.5
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 +34 -24
- package/ui-cv/cv-date-base/cv-date-base.vue +27 -6
- package/ui-cv/cv-datetime-base/cv-datetime-base.vue +31 -7
- 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 +14 -13
- 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 -13
- package/ui-cv/cv-input-idcard/cv-input-idcard.vue +70 -14
- package/ui-cv/cv-input-number/cv-input-number.vue +56 -13
- package/ui-cv/cv-input-password/cv-input-password.vue +66 -12
- 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 +24 -15
- package/ui-cv/cv-search/cv-search.vue +7 -1
- package/ui-cv/cv-specs/cv-specs.vue +13 -13
- package/ui-cv/cv-switch/cv-switch.vue +24 -16
- package/ui-cv/cv-textarea/cv-textarea.vue +18 -12
- 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 +21 -10
- 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
|
@@ -24,30 +24,86 @@
|
|
|
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
|
-
inject: {
|
|
32
|
-
cvFormGroup: {
|
|
33
|
-
default() {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
29
|
props: {
|
|
30
|
+
value: {
|
|
31
|
+
type: [Number, String],
|
|
32
|
+
default: ''
|
|
33
|
+
},
|
|
34
|
+
modelValue: {
|
|
35
|
+
type: [Number, String],
|
|
36
|
+
default: ''
|
|
37
|
+
},
|
|
39
38
|
placeholder: {
|
|
40
39
|
type: [String],
|
|
41
40
|
default: '请输入数字'
|
|
41
|
+
},
|
|
42
|
+
disabled: {
|
|
43
|
+
type: [Boolean],
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
clearable: {
|
|
47
|
+
type: [Boolean],
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
maxlength: {
|
|
51
|
+
type: [Number, String],
|
|
52
|
+
default: -1
|
|
42
53
|
}
|
|
43
54
|
},
|
|
44
55
|
// 监听动态数据变化
|
|
45
|
-
watch: {
|
|
56
|
+
watch: {
|
|
57
|
+
value(newVal) {
|
|
58
|
+
this.localVal = newVal;
|
|
59
|
+
},
|
|
60
|
+
modelValue(newVal) {
|
|
61
|
+
this.localVal = newVal;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
46
64
|
data() {
|
|
47
|
-
return {
|
|
65
|
+
return {
|
|
66
|
+
localStyle: '',
|
|
67
|
+
localVal: ''
|
|
68
|
+
};
|
|
48
69
|
},
|
|
49
|
-
created() {
|
|
50
|
-
|
|
70
|
+
created() {
|
|
71
|
+
this.localVal = this.doValueGet();
|
|
72
|
+
},
|
|
73
|
+
mounted() {
|
|
74
|
+
this._itemStyle();
|
|
75
|
+
},
|
|
76
|
+
methods: {
|
|
77
|
+
doValueGet() {
|
|
78
|
+
if (this.value === '') return this.modelValue;
|
|
79
|
+
if (this.modelValue === '') return this.value;
|
|
80
|
+
return this.value;
|
|
81
|
+
},
|
|
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
|
+
}
|
|
106
|
+
}
|
|
51
107
|
};
|
|
52
108
|
</script>
|
|
53
109
|
<style>
|
|
@@ -20,34 +20,90 @@
|
|
|
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
|
-
inject: {
|
|
28
|
-
cvFormGroup: {
|
|
29
|
-
default() {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
25
|
props: {
|
|
26
|
+
value: {
|
|
27
|
+
type: [Number, String],
|
|
28
|
+
default: ''
|
|
29
|
+
},
|
|
30
|
+
modelValue: {
|
|
31
|
+
type: [Number, String],
|
|
32
|
+
default: ''
|
|
33
|
+
},
|
|
35
34
|
placeholder: {
|
|
36
35
|
type: [String],
|
|
37
36
|
default: '请输入身份证'
|
|
37
|
+
},
|
|
38
|
+
disabled: {
|
|
39
|
+
type: [Boolean],
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
clearable: {
|
|
43
|
+
type: [Boolean],
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
maxlength: {
|
|
47
|
+
type: [Number, String],
|
|
48
|
+
default: -1
|
|
38
49
|
}
|
|
39
50
|
},
|
|
40
51
|
data() {
|
|
41
|
-
return {
|
|
52
|
+
return {
|
|
53
|
+
localStyle: '',
|
|
54
|
+
localVal: ''
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
watch: {
|
|
58
|
+
value(newVal) {
|
|
59
|
+
this.localVal = newVal;
|
|
60
|
+
},
|
|
61
|
+
modelValue(newVal) {
|
|
62
|
+
this.localVal = newVal;
|
|
63
|
+
}
|
|
42
64
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
65
|
+
created() {
|
|
66
|
+
this.localVal = this.doValueGet();
|
|
67
|
+
},
|
|
68
|
+
mounted() {
|
|
69
|
+
this._itemStyle();
|
|
70
|
+
},
|
|
71
|
+
methods: {
|
|
72
|
+
doValueGet() {
|
|
73
|
+
if (this.value === '') return this.modelValue;
|
|
74
|
+
if (this.modelValue === '') return this.value;
|
|
75
|
+
return this.value;
|
|
76
|
+
},
|
|
77
|
+
_itemStyle() {
|
|
78
|
+
/* 计算输入框右侧预留空间 */
|
|
79
|
+
let paddingRight = 0;
|
|
80
|
+
if (this.$slots['append']) {
|
|
81
|
+
paddingRight += 20;
|
|
82
|
+
}
|
|
83
|
+
if (this.clearable) {
|
|
84
|
+
paddingRight += 30;
|
|
85
|
+
}
|
|
86
|
+
this.localStyle = 'margin-right:' + paddingRight + 'px;';
|
|
87
|
+
},
|
|
88
|
+
onBlur(e) {
|
|
89
|
+
this.localVal = e.detail.value;
|
|
90
|
+
this.funcOnInput();
|
|
91
|
+
},
|
|
92
|
+
funcOnInput(e) {
|
|
93
|
+
this.$emit('input', this.localVal);
|
|
94
|
+
this.$emit('update:modelValue', this.localVal);
|
|
95
|
+
},
|
|
96
|
+
/* 监听自己清除按钮点击事件 */
|
|
97
|
+
onEmpty() {
|
|
98
|
+
this.localVal = '';
|
|
99
|
+
this.funcOnInput();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
46
102
|
};
|
|
47
103
|
</script>
|
|
48
104
|
<style>
|
|
49
105
|
.cv-input__content {
|
|
50
|
-
height: 36px;
|
|
106
|
+
min-height: 36px;
|
|
51
107
|
line-height: 36px;
|
|
52
108
|
font-size: 14px;
|
|
53
109
|
}
|
|
@@ -22,37 +22,80 @@
|
|
|
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
|
-
inject: {
|
|
32
|
-
cvFormGroup: {
|
|
33
|
-
default() {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
28
|
props: {
|
|
29
|
+
value: {
|
|
30
|
+
type: [Number, String],
|
|
31
|
+
default: ''
|
|
32
|
+
},
|
|
33
|
+
modelValue: {
|
|
34
|
+
type: [Number, String],
|
|
35
|
+
default: ''
|
|
36
|
+
},
|
|
39
37
|
placeholder: {
|
|
40
38
|
type: [String],
|
|
41
39
|
default: '请输入数字'
|
|
40
|
+
},
|
|
41
|
+
disabled: {
|
|
42
|
+
type: [Boolean],
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
clearable: {
|
|
46
|
+
type: [Boolean],
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
maxlength: {
|
|
50
|
+
type: [Number, String],
|
|
51
|
+
default: -1
|
|
42
52
|
}
|
|
43
53
|
},
|
|
44
54
|
data() {
|
|
45
|
-
return {
|
|
55
|
+
return {
|
|
56
|
+
localStyle: '',
|
|
57
|
+
localVal: ''
|
|
58
|
+
};
|
|
46
59
|
},
|
|
47
60
|
watch: {
|
|
48
61
|
value(newVal) {
|
|
49
62
|
this.localVal = this._dealValue(newVal);
|
|
63
|
+
},
|
|
64
|
+
modelValue(newVal) {
|
|
65
|
+
this.localVal = this._dealValue(newVal);
|
|
50
66
|
}
|
|
51
67
|
},
|
|
52
68
|
created() {
|
|
53
|
-
this.localVal = this._dealValue(this.value);
|
|
69
|
+
// this.localVal = this._dealValue(this.value);
|
|
70
|
+
},
|
|
71
|
+
mounted() {
|
|
72
|
+
this._itemStyle();
|
|
54
73
|
},
|
|
55
74
|
methods: {
|
|
75
|
+
_itemStyle() {
|
|
76
|
+
/* 计算输入框右侧预留空间 */
|
|
77
|
+
let paddingRight = 0;
|
|
78
|
+
if (this.$slots['append']) {
|
|
79
|
+
paddingRight += 20;
|
|
80
|
+
}
|
|
81
|
+
if (this.clearable) {
|
|
82
|
+
paddingRight += 30;
|
|
83
|
+
}
|
|
84
|
+
this.localStyle = 'margin-right:' + paddingRight + 'px;';
|
|
85
|
+
},
|
|
86
|
+
onBlur(e) {
|
|
87
|
+
this.localVal = e.detail.value;
|
|
88
|
+
this.funcOnInput();
|
|
89
|
+
},
|
|
90
|
+
funcOnInput(e) {
|
|
91
|
+
this.$emit('input', this.localVal);
|
|
92
|
+
this.$emit('update:modelValue', this.localVal);
|
|
93
|
+
},
|
|
94
|
+
/* 监听自己清除按钮点击事件 */
|
|
95
|
+
onEmpty() {
|
|
96
|
+
this.localVal = '';
|
|
97
|
+
this.funcOnInput();
|
|
98
|
+
},
|
|
56
99
|
_dealValue(value) {
|
|
57
100
|
if (Object.prototype.toString.call(value) === '[object Number]') {
|
|
58
101
|
return value.toString();
|
|
@@ -66,7 +109,7 @@ export default {
|
|
|
66
109
|
|
|
67
110
|
<style>
|
|
68
111
|
.cv-input__content {
|
|
69
|
-
height: 36px;
|
|
112
|
+
min-height: 36px;
|
|
70
113
|
line-height: 36px;
|
|
71
114
|
font-size: 14px;
|
|
72
115
|
}
|
|
@@ -30,35 +30,89 @@
|
|
|
30
30
|
</template>
|
|
31
31
|
|
|
32
32
|
<script>
|
|
33
|
-
import MixinsInput from '../mixins/mixins-input.js';
|
|
34
33
|
export default {
|
|
35
|
-
mixins: [MixinsInput],
|
|
36
34
|
name: 'cvInputPassword',
|
|
37
|
-
inject: {
|
|
38
|
-
cvFormGroup: {
|
|
39
|
-
default() {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
35
|
props: {
|
|
36
|
+
value: {
|
|
37
|
+
type: [Number, String],
|
|
38
|
+
default: ''
|
|
39
|
+
},
|
|
40
|
+
modelValue: {
|
|
41
|
+
type: [Number, String],
|
|
42
|
+
default: ''
|
|
43
|
+
},
|
|
45
44
|
placeholder: {
|
|
46
45
|
type: [String],
|
|
47
46
|
default: '请输入密码'
|
|
48
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
|
|
59
|
+
},
|
|
49
60
|
passwordIcon: {
|
|
50
61
|
type: Boolean,
|
|
51
62
|
default: true
|
|
52
63
|
}
|
|
53
64
|
},
|
|
54
|
-
watch: {
|
|
65
|
+
watch: {
|
|
66
|
+
value(newVal) {
|
|
67
|
+
this.localVal = newVal;
|
|
68
|
+
},
|
|
69
|
+
modelValue(newVal) {
|
|
70
|
+
this.localVal = newVal;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
55
73
|
data() {
|
|
56
74
|
return {
|
|
75
|
+
localStyle: '',
|
|
76
|
+
localVal: '',
|
|
57
77
|
showPassword: false
|
|
58
78
|
};
|
|
59
79
|
},
|
|
60
|
-
created() {
|
|
80
|
+
created() {
|
|
81
|
+
this.localVal = this.doValueGet();
|
|
82
|
+
},
|
|
83
|
+
mounted() {
|
|
84
|
+
this._itemStyle();
|
|
85
|
+
},
|
|
61
86
|
methods: {
|
|
87
|
+
doValueGet() {
|
|
88
|
+
if (this.value === '') return this.modelValue;
|
|
89
|
+
if (this.modelValue === '') return this.value;
|
|
90
|
+
return this.value;
|
|
91
|
+
},
|
|
92
|
+
_itemStyle() {
|
|
93
|
+
/* 计算输入框右侧预留空间 */
|
|
94
|
+
let paddingRight = 0;
|
|
95
|
+
if (this.$slots['append']) {
|
|
96
|
+
paddingRight += 20;
|
|
97
|
+
}
|
|
98
|
+
if (this.clearable) {
|
|
99
|
+
paddingRight += 30;
|
|
100
|
+
}
|
|
101
|
+
this.localStyle = 'margin-right:' + paddingRight + 'px;';
|
|
102
|
+
},
|
|
103
|
+
onBlur(e) {
|
|
104
|
+
this.localVal = e.detail.value;
|
|
105
|
+
this.funcOnInput();
|
|
106
|
+
},
|
|
107
|
+
funcOnInput(e) {
|
|
108
|
+
this.$emit('input', this.localVal);
|
|
109
|
+
this.$emit('update:modelValue', this.localVal);
|
|
110
|
+
},
|
|
111
|
+
/* 监听自己清除按钮点击事件 */
|
|
112
|
+
onEmpty() {
|
|
113
|
+
this.localVal = '';
|
|
114
|
+
this.funcOnInput();
|
|
115
|
+
},
|
|
62
116
|
onEyes() {
|
|
63
117
|
this.showPassword = !this.showPassword;
|
|
64
118
|
}
|
|
@@ -67,7 +121,7 @@ export default {
|
|
|
67
121
|
</script>
|
|
68
122
|
<style>
|
|
69
123
|
.cv-input__content {
|
|
70
|
-
height: 36px;
|
|
124
|
+
min-height: 36px;
|
|
71
125
|
line-height: 36px;
|
|
72
126
|
font-size: 14px;
|
|
73
127
|
}
|
|
@@ -23,31 +23,98 @@
|
|
|
23
23
|
</view>
|
|
24
24
|
</view>
|
|
25
25
|
</template>
|
|
26
|
-
|
|
27
26
|
<script>
|
|
28
|
-
import MixinsInput from '../mixins/mixins-input.js';
|
|
29
27
|
export default {
|
|
30
|
-
mixins: [MixinsInput],
|
|
31
28
|
name: 'cvInputText',
|
|
32
29
|
options: {
|
|
33
30
|
addGlobalClass: true
|
|
34
31
|
},
|
|
35
32
|
props: {
|
|
33
|
+
value: {
|
|
34
|
+
type: [Number, String],
|
|
35
|
+
default: ''
|
|
36
|
+
},
|
|
37
|
+
modelValue: {
|
|
38
|
+
type: [Number, String],
|
|
39
|
+
default: ''
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
type: [String],
|
|
43
|
+
default: '请输入'
|
|
44
|
+
},
|
|
45
|
+
clearable: {
|
|
46
|
+
type: [Boolean],
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
maxlength: {
|
|
50
|
+
type: [Number, String],
|
|
51
|
+
default: -1
|
|
52
|
+
},
|
|
53
|
+
disabled: {
|
|
54
|
+
type: [Boolean],
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
36
57
|
placeholder: {
|
|
37
58
|
type: [String],
|
|
38
59
|
default: '请输入文本'
|
|
39
60
|
}
|
|
40
61
|
},
|
|
62
|
+
watch: {
|
|
63
|
+
value(newVal) {
|
|
64
|
+
this.localVal = newVal;
|
|
65
|
+
},
|
|
66
|
+
modelValue(newVal) {
|
|
67
|
+
this.localVal = newVal;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
41
70
|
data() {
|
|
42
|
-
return {
|
|
71
|
+
return {
|
|
72
|
+
localStyle: '',
|
|
73
|
+
localVal: ''
|
|
74
|
+
};
|
|
43
75
|
},
|
|
44
|
-
created() {
|
|
45
|
-
|
|
76
|
+
created() {
|
|
77
|
+
// this.localVal = this.doValueGet();
|
|
78
|
+
},
|
|
79
|
+
mounted() {
|
|
80
|
+
this._itemStyle();
|
|
81
|
+
},
|
|
82
|
+
methods: {
|
|
83
|
+
doValueGet() {
|
|
84
|
+
if (this.value === '') return this.modelValue;
|
|
85
|
+
if (this.modelValue === '') return this.value;
|
|
86
|
+
return this.value;
|
|
87
|
+
},
|
|
88
|
+
_itemStyle() {
|
|
89
|
+
/* 计算输入框右侧预留空间 */
|
|
90
|
+
let paddingRight = 0;
|
|
91
|
+
if (this.$slots['append']) {
|
|
92
|
+
paddingRight += 20;
|
|
93
|
+
}
|
|
94
|
+
if (this.clearable) {
|
|
95
|
+
paddingRight += 30;
|
|
96
|
+
}
|
|
97
|
+
this.localStyle = 'margin-right:' + paddingRight + 'px;';
|
|
98
|
+
},
|
|
99
|
+
onBlur(e) {
|
|
100
|
+
this.localVal = e.detail.value;
|
|
101
|
+
this.funcOnInput();
|
|
102
|
+
},
|
|
103
|
+
funcOnInput(e) {
|
|
104
|
+
this.$emit('input', this.localVal);
|
|
105
|
+
this.$emit('update:modelValue', this.localVal);
|
|
106
|
+
},
|
|
107
|
+
/* 监听自己清除按钮点击事件 */
|
|
108
|
+
onEmpty() {
|
|
109
|
+
this.localVal = '';
|
|
110
|
+
this.funcOnInput();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
46
113
|
};
|
|
47
114
|
</script>
|
|
48
115
|
<style>
|
|
49
116
|
.cv-input__content {
|
|
50
|
-
height: 36px;
|
|
117
|
+
min-height: 36px;
|
|
51
118
|
line-height: 36px;
|
|
52
119
|
font-size: 14px;
|
|
53
120
|
}
|
|
@@ -16,16 +16,17 @@
|
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script>
|
|
19
|
-
import MixinsPicker from '../mixins/mixins-picker.js';
|
|
20
19
|
export default {
|
|
21
|
-
mixins: [MixinsPicker],
|
|
22
20
|
name: 'cvPicker1',
|
|
23
21
|
props: {
|
|
24
|
-
//默认输入框内容
|
|
25
22
|
value: {
|
|
26
23
|
type: [Number, String],
|
|
27
24
|
default: ''
|
|
28
25
|
},
|
|
26
|
+
modelValue: {
|
|
27
|
+
type: [Number, String],
|
|
28
|
+
default: ''
|
|
29
|
+
},
|
|
29
30
|
dataType: {
|
|
30
31
|
type: String,
|
|
31
32
|
default: 'value'
|
|
@@ -44,6 +45,11 @@ export default {
|
|
|
44
45
|
dataText: {
|
|
45
46
|
type: String,
|
|
46
47
|
default: 'text'
|
|
48
|
+
},
|
|
49
|
+
// 占位符
|
|
50
|
+
placeholder: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: '请选择'
|
|
47
53
|
}
|
|
48
54
|
},
|
|
49
55
|
data() {
|
|
@@ -71,14 +77,24 @@ export default {
|
|
|
71
77
|
value(newVal) {
|
|
72
78
|
this.localVal = newVal;
|
|
73
79
|
this._dealValue();
|
|
80
|
+
},
|
|
81
|
+
modelValue(newVal) {
|
|
82
|
+
this.localVal = newVal;
|
|
83
|
+
this._dealValue();
|
|
74
84
|
}
|
|
75
85
|
},
|
|
76
86
|
created() {
|
|
77
|
-
this.localVal = this.
|
|
87
|
+
this.localVal = this.doValueGet();
|
|
88
|
+
console.log(this.localVal);
|
|
78
89
|
this.localArr = this.itemsSortOut();
|
|
79
90
|
this._dealValue();
|
|
80
91
|
},
|
|
81
92
|
methods: {
|
|
93
|
+
doValueGet() {
|
|
94
|
+
if (this.value === '') return this.modelValue;
|
|
95
|
+
if (this.modelValue === '') return this.value;
|
|
96
|
+
return this.value;
|
|
97
|
+
},
|
|
82
98
|
/**
|
|
83
99
|
* 处理-循环数组数据
|
|
84
100
|
*/
|
|
@@ -153,8 +169,16 @@ export default {
|
|
|
153
169
|
} else {
|
|
154
170
|
this.localVal = rowData.value;
|
|
155
171
|
}
|
|
172
|
+
this.iconTop = false;
|
|
173
|
+
console.log(this.localVal);
|
|
156
174
|
this.$emit('input', this.localVal);
|
|
175
|
+
this.$emit('update:modelValue', this.localVal);
|
|
176
|
+
},
|
|
177
|
+
bindPickerCancel() {
|
|
157
178
|
this.iconTop = false;
|
|
179
|
+
},
|
|
180
|
+
changeIconTop() {
|
|
181
|
+
this.iconTop = true;
|
|
158
182
|
}
|
|
159
183
|
}
|
|
160
184
|
};
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
</picker>
|
|
22
22
|
</view>
|
|
23
23
|
</template>
|
|
24
|
-
|
|
25
24
|
<script>
|
|
26
|
-
import MixinsPicker from '../mixins/mixins-picker.js';
|
|
27
25
|
export default {
|
|
28
|
-
mixins: [MixinsPicker],
|
|
29
26
|
name: 'cvPicker2',
|
|
30
27
|
props: {
|
|
31
|
-
//默认输入框内容
|
|
32
28
|
value: {
|
|
33
|
-
type: Array,
|
|
34
|
-
default: []
|
|
29
|
+
type: [Array],
|
|
30
|
+
default: () => []
|
|
31
|
+
},
|
|
32
|
+
modelValue: {
|
|
33
|
+
type: [Array],
|
|
34
|
+
default: () => []
|
|
35
35
|
},
|
|
36
36
|
dataType: {
|
|
37
37
|
type: String,
|
|
@@ -59,6 +59,11 @@ export default {
|
|
|
59
59
|
joint: {
|
|
60
60
|
type: String,
|
|
61
61
|
default: ''
|
|
62
|
+
},
|
|
63
|
+
// 占位符
|
|
64
|
+
placeholder: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: '请选择'
|
|
62
67
|
}
|
|
63
68
|
},
|
|
64
69
|
watch: {
|
|
@@ -71,6 +76,10 @@ export default {
|
|
|
71
76
|
value(newVal) {
|
|
72
77
|
this.localVal = newVal;
|
|
73
78
|
this.itemsSortOut();
|
|
79
|
+
},
|
|
80
|
+
modelValue(newVal) {
|
|
81
|
+
this.localVal = newVal;
|
|
82
|
+
this.itemsSortOut();
|
|
74
83
|
}
|
|
75
84
|
},
|
|
76
85
|
data() {
|
|
@@ -83,17 +92,26 @@ export default {
|
|
|
83
92
|
items_sub: [],
|
|
84
93
|
items_index: [0, 0], //当前下标
|
|
85
94
|
lastRetDataIndex: [0, 0], // 最终确定选中的下标
|
|
86
|
-
localDataType: '',
|
|
95
|
+
localDataType: 'value',
|
|
87
96
|
localDataValue: 'value',
|
|
88
97
|
localDataText: 'label'
|
|
89
98
|
};
|
|
90
99
|
},
|
|
91
100
|
created() {
|
|
92
|
-
this.localVal = this.
|
|
101
|
+
this.localVal = this.doValueGet();
|
|
93
102
|
this.localDataType = this.dataType != 'text' ? 'value' : 'text';
|
|
94
103
|
this.itemsSortOut();
|
|
95
104
|
},
|
|
96
105
|
methods: {
|
|
106
|
+
doValueGet() {
|
|
107
|
+
if (this.value === '' || (Array.prototype.isPrototypeOf(this.value) && this.value.length === 0)) {
|
|
108
|
+
return this.modelValue.length != 2 ? [0, 0] : this.modelValue;
|
|
109
|
+
}
|
|
110
|
+
if (this.modelValue === '' || (Array.prototype.isPrototypeOf(this.modelValue) && this.modelValue.length === 0)) {
|
|
111
|
+
return this.value.length != 2 ? [0, 0] : this.value;
|
|
112
|
+
}
|
|
113
|
+
return this.value.length != 2 ? [0, 0] : this.value;
|
|
114
|
+
},
|
|
97
115
|
itemsSortOut() {
|
|
98
116
|
let original = [];
|
|
99
117
|
original = this.dataLists || [];
|
|
@@ -109,13 +127,14 @@ export default {
|
|
|
109
127
|
let items = [];
|
|
110
128
|
let dataValue = this.dataValue ? this.dataValue : 'value';
|
|
111
129
|
let dataText = this.dataText ? this.dataText : 'text';
|
|
130
|
+
|
|
112
131
|
let tree = this.dataTree;
|
|
113
132
|
let items_index = this.items_index;
|
|
114
133
|
let dataType = this.localDataType;
|
|
115
134
|
for (let i in original) {
|
|
116
135
|
let data = original[i];
|
|
117
136
|
//查找一级绑定参数
|
|
118
|
-
if (this.localVal
|
|
137
|
+
if (this.localVal && this.localVal.length >= 1) {
|
|
119
138
|
if (dataType == 'text' && this.localVal[0] == data[dataText]) {
|
|
120
139
|
items_index[0] = i;
|
|
121
140
|
} else if (dataType == 'value' && this.localVal[0] == data[dataValue]) {
|
|
@@ -134,7 +153,7 @@ export default {
|
|
|
134
153
|
let data = tree_data[ii];
|
|
135
154
|
|
|
136
155
|
//查找二级绑定参数
|
|
137
|
-
if (this.localVal
|
|
156
|
+
if (this.localVal && this.localVal.length >= 2) {
|
|
138
157
|
if (dataType == 'text' && this.localVal[1] == data[dataText]) {
|
|
139
158
|
items_index[1] = ii;
|
|
140
159
|
} else if (dataType == 'value' && this.localVal[1] == data[dataValue]) {
|
|
@@ -158,7 +177,7 @@ export default {
|
|
|
158
177
|
this.range_data = [items, this.items_sub];
|
|
159
178
|
this.last_range_data = [...this.range_data];
|
|
160
179
|
this.items_index = items_index;
|
|
161
|
-
if (this.
|
|
180
|
+
if (this.localVal && this.localVal.length == 2) {
|
|
162
181
|
this.lastRetDataIndex = [...this.items_index];
|
|
163
182
|
}
|
|
164
183
|
},
|
|
@@ -168,6 +187,9 @@ export default {
|
|
|
168
187
|
this.updateLocalVal();
|
|
169
188
|
this.iconTop = false;
|
|
170
189
|
},
|
|
190
|
+
changeIconTop() {
|
|
191
|
+
this.iconTop = true;
|
|
192
|
+
},
|
|
171
193
|
/* 取消选择 */
|
|
172
194
|
onCancel(e) {
|
|
173
195
|
this.iconTop = false;
|
|
@@ -203,6 +225,7 @@ export default {
|
|
|
203
225
|
}
|
|
204
226
|
this.localVal = value;
|
|
205
227
|
this.$emit('input', value);
|
|
228
|
+
this.$emit('update:modelValue', value);
|
|
206
229
|
}
|
|
207
230
|
}
|
|
208
231
|
};
|