@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
|
@@ -30,9 +30,7 @@
|
|
|
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
35
|
inject: {
|
|
38
36
|
cvFormGroup: {
|
|
@@ -42,23 +40,86 @@ export default {
|
|
|
42
40
|
}
|
|
43
41
|
},
|
|
44
42
|
props: {
|
|
43
|
+
value: {
|
|
44
|
+
type: [Number, String],
|
|
45
|
+
default: ''
|
|
46
|
+
},
|
|
47
|
+
modelValue: {
|
|
48
|
+
type: [Number, String],
|
|
49
|
+
default: ''
|
|
50
|
+
},
|
|
45
51
|
placeholder: {
|
|
46
52
|
type: [String],
|
|
47
53
|
default: '请输入密码'
|
|
48
54
|
},
|
|
55
|
+
disabled: {
|
|
56
|
+
type: [Boolean],
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
clearable: {
|
|
60
|
+
type: [Boolean],
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
maxlength: {
|
|
64
|
+
type: [Number, String],
|
|
65
|
+
default: -1
|
|
66
|
+
},
|
|
49
67
|
passwordIcon: {
|
|
50
68
|
type: Boolean,
|
|
51
69
|
default: true
|
|
52
70
|
}
|
|
53
71
|
},
|
|
54
|
-
watch: {
|
|
72
|
+
watch: {
|
|
73
|
+
value(newVal) {
|
|
74
|
+
this.localVal = newVal;
|
|
75
|
+
},
|
|
76
|
+
modelValue(newVal) {
|
|
77
|
+
this.localVal = newVal;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
55
80
|
data() {
|
|
56
81
|
return {
|
|
82
|
+
localStyle: '',
|
|
83
|
+
localVal: '',
|
|
57
84
|
showPassword: false
|
|
58
85
|
};
|
|
59
86
|
},
|
|
60
|
-
created() {
|
|
87
|
+
created() {
|
|
88
|
+
this.localVal = this.doValueGet();
|
|
89
|
+
},
|
|
90
|
+
mounted() {
|
|
91
|
+
this._itemStyle();
|
|
92
|
+
},
|
|
61
93
|
methods: {
|
|
94
|
+
doValueGet() {
|
|
95
|
+
if (this.value === '') return this.modelValue;
|
|
96
|
+
if (this.modelValue === '') return this.value;
|
|
97
|
+
return this.value;
|
|
98
|
+
},
|
|
99
|
+
_itemStyle() {
|
|
100
|
+
/* 计算输入框右侧预留空间 */
|
|
101
|
+
let paddingRight = 0;
|
|
102
|
+
if (this.$slots['append']) {
|
|
103
|
+
paddingRight += 20;
|
|
104
|
+
}
|
|
105
|
+
if (this.clearable) {
|
|
106
|
+
paddingRight += 30;
|
|
107
|
+
}
|
|
108
|
+
this.localStyle = 'margin-right:' + paddingRight + 'px;';
|
|
109
|
+
},
|
|
110
|
+
onBlur(e) {
|
|
111
|
+
this.localVal = e.detail.value;
|
|
112
|
+
this.funcOnInput();
|
|
113
|
+
},
|
|
114
|
+
funcOnInput(e) {
|
|
115
|
+
this.$emit('input', this.localVal);
|
|
116
|
+
this.$emit('update:modelValue', this.localVal);
|
|
117
|
+
},
|
|
118
|
+
/* 监听自己清除按钮点击事件 */
|
|
119
|
+
onEmpty() {
|
|
120
|
+
this.localVal = '';
|
|
121
|
+
this.funcOnInput();
|
|
122
|
+
},
|
|
62
123
|
onEyes() {
|
|
63
124
|
this.showPassword = !this.showPassword;
|
|
64
125
|
}
|
|
@@ -67,7 +128,7 @@ export default {
|
|
|
67
128
|
</script>
|
|
68
129
|
<style>
|
|
69
130
|
.cv-input__content {
|
|
70
|
-
height: 36px;
|
|
131
|
+
min-height: 36px;
|
|
71
132
|
line-height: 36px;
|
|
72
133
|
font-size: 14px;
|
|
73
134
|
}
|
|
@@ -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
|
};
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
</picker>
|
|
33
33
|
</view>
|
|
34
34
|
</template>
|
|
35
|
-
|
|
36
35
|
<script>
|
|
37
|
-
import MixinsPicker from '../mixins/mixins-picker.js';
|
|
38
36
|
export default {
|
|
39
|
-
mixins: [MixinsPicker],
|
|
40
37
|
name: 'cvPicker3',
|
|
41
38
|
props: {
|
|
42
|
-
//默认输入框内容
|
|
43
39
|
value: {
|
|
44
|
-
type: Array,
|
|
45
|
-
default: () =>
|
|
40
|
+
type: [Array],
|
|
41
|
+
default: () => []
|
|
42
|
+
},
|
|
43
|
+
modelValue: {
|
|
44
|
+
type: [Array],
|
|
45
|
+
default: () => []
|
|
46
46
|
},
|
|
47
47
|
dataType: {
|
|
48
48
|
type: String,
|
|
@@ -70,6 +70,11 @@ export default {
|
|
|
70
70
|
joint: {
|
|
71
71
|
type: String,
|
|
72
72
|
default: ''
|
|
73
|
+
},
|
|
74
|
+
// 占位符
|
|
75
|
+
placeholder: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: '请选择'
|
|
73
78
|
}
|
|
74
79
|
},
|
|
75
80
|
watch: {
|
|
@@ -82,12 +87,16 @@ export default {
|
|
|
82
87
|
value(newVal) {
|
|
83
88
|
this.localVal = newVal;
|
|
84
89
|
this.itemsSortOut();
|
|
90
|
+
},
|
|
91
|
+
modelValue(newVal) {
|
|
92
|
+
this.localVal = newVal;
|
|
93
|
+
this.itemsSortOut();
|
|
85
94
|
}
|
|
86
95
|
},
|
|
87
96
|
data() {
|
|
88
97
|
return {
|
|
89
98
|
iconTop: false,
|
|
90
|
-
localVal:
|
|
99
|
+
localVal: [],
|
|
91
100
|
items: [], //全部数据
|
|
92
101
|
range_data: [], //弹窗临时数组
|
|
93
102
|
last_range_data: [], //最终显示页面数组
|
|
@@ -95,15 +104,26 @@ export default {
|
|
|
95
104
|
items_sub2: [],
|
|
96
105
|
items_index: [0, 0, 0], //当前下标
|
|
97
106
|
lastRetDataIndex: [0, 0, 0], // 最终确定选中的下标
|
|
98
|
-
localDataType: ''
|
|
107
|
+
localDataType: 'value',
|
|
108
|
+
localDataValue: 'value',
|
|
109
|
+
localDataText: 'label'
|
|
99
110
|
};
|
|
100
111
|
},
|
|
101
112
|
created() {
|
|
102
|
-
this.localVal = this.
|
|
113
|
+
this.localVal = this.doValueGet();
|
|
103
114
|
this.localDataType = this.dataType != 'text' ? 'value' : 'text';
|
|
104
115
|
this.itemsSortOut();
|
|
105
116
|
},
|
|
106
117
|
methods: {
|
|
118
|
+
doValueGet() {
|
|
119
|
+
if (this.value === '' || (Array.prototype.isPrototypeOf(this.value) && this.value.length === 0)) {
|
|
120
|
+
return this.modelValue;
|
|
121
|
+
}
|
|
122
|
+
if (this.modelValue === '' || (Array.prototype.isPrototypeOf(this.modelValue) && this.modelValue.length === 0)) {
|
|
123
|
+
return this.value;
|
|
124
|
+
}
|
|
125
|
+
return this.value;
|
|
126
|
+
},
|
|
107
127
|
itemsSortOut() {
|
|
108
128
|
let original = [];
|
|
109
129
|
original = this.dataLists || [];
|
|
@@ -111,7 +131,8 @@ export default {
|
|
|
111
131
|
if (typeof original == 'string') {
|
|
112
132
|
original = JSON.parse(original);
|
|
113
133
|
}
|
|
114
|
-
if (!original) {
|
|
134
|
+
if (!original || original.length <= 0) {
|
|
135
|
+
console.warn('original 暂无数据', original);
|
|
115
136
|
return;
|
|
116
137
|
}
|
|
117
138
|
//整理数据
|
|
@@ -126,7 +147,7 @@ export default {
|
|
|
126
147
|
let data = original[i];
|
|
127
148
|
//查找一级绑定参数
|
|
128
149
|
|
|
129
|
-
if (this.localVal.length >= 1) {
|
|
150
|
+
if (this.localVal && this.localVal.length >= 1) {
|
|
130
151
|
if (dataType == 'text' && this.localVal[0] == data[dataText]) {
|
|
131
152
|
items_index[0] = i;
|
|
132
153
|
} else if (dataType == 'value' && this.localVal[0] == data[dataValue]) {
|
|
@@ -144,7 +165,7 @@ export default {
|
|
|
144
165
|
let data = tree_data[ii];
|
|
145
166
|
|
|
146
167
|
//查找二级绑定参数
|
|
147
|
-
if (this.localVal.length >= 2) {
|
|
168
|
+
if (this.localVal && this.localVal.length >= 2) {
|
|
148
169
|
if (dataType == 'text' && this.localVal[1] == data[dataText]) {
|
|
149
170
|
items_index[1] = ii;
|
|
150
171
|
} else if (dataType == 'value' && this.localVal[1] == data[dataValue]) {
|
|
@@ -164,7 +185,7 @@ export default {
|
|
|
164
185
|
for (const iii in tree_data2) {
|
|
165
186
|
let data = tree_data2[iii];
|
|
166
187
|
//查找三级绑定参数
|
|
167
|
-
if (this.localVal.length >= 3) {
|
|
188
|
+
if (this.localVal && this.localVal.length >= 3) {
|
|
168
189
|
if (dataType == 'text' && this.localVal[2] == data[dataText]) {
|
|
169
190
|
items_index[2] = iii;
|
|
170
191
|
} else if (dataType == 'value' && this.localVal[2] == data[dataValue]) {
|
|
@@ -199,16 +220,19 @@ export default {
|
|
|
199
220
|
this.range_data = [items, this.items_sub, this.items_sub2];
|
|
200
221
|
this.items_index = items_index;
|
|
201
222
|
this.last_range_data = [...this.range_data];
|
|
202
|
-
if (this.
|
|
223
|
+
if (this.localVal && this.localVal.length == 3) {
|
|
203
224
|
this.lastRetDataIndex = [...this.items_index];
|
|
204
225
|
}
|
|
205
226
|
},
|
|
206
227
|
bindPickerChange: function (e) {
|
|
207
228
|
let items_index = e.detail.value;
|
|
208
229
|
this.items_index = items_index;
|
|
209
|
-
this.
|
|
230
|
+
this.updateLocalVal();
|
|
210
231
|
this.iconTop = false;
|
|
211
232
|
},
|
|
233
|
+
changeIconTop() {
|
|
234
|
+
this.iconTop = true;
|
|
235
|
+
},
|
|
212
236
|
/* 取消选择 */
|
|
213
237
|
onCancel(e) {
|
|
214
238
|
this.iconTop = false;
|
|
@@ -242,7 +266,7 @@ export default {
|
|
|
242
266
|
this.$forceUpdate();
|
|
243
267
|
// this.funcOnInput();
|
|
244
268
|
},
|
|
245
|
-
|
|
269
|
+
updateLocalVal() {
|
|
246
270
|
let items_index = this.items_index;
|
|
247
271
|
this.last_range_data = [...this.range_data];
|
|
248
272
|
this.lastRetDataIndex = [...items_index];
|
|
@@ -262,6 +286,7 @@ export default {
|
|
|
262
286
|
value[2] = items[items_index[0]].tree[items_index[1]].tree[items_index[2]].value;
|
|
263
287
|
}
|
|
264
288
|
this.$emit('input', value);
|
|
289
|
+
this.$emit('update:modelValue', value);
|
|
265
290
|
}
|
|
266
291
|
}
|
|
267
292
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="cv-radio-group-wrap">
|
|
3
|
-
<radio-group @change="radioChange" class="cv-radio-group__box">
|
|
3
|
+
<radio-group @change="radioChange" class="cv-radio-group__box" :style="localStyle">
|
|
4
4
|
<slot>
|
|
5
5
|
<cv-radio-opt-base
|
|
6
6
|
v-if="type == 'base'"
|
|
@@ -41,14 +41,21 @@ export default {
|
|
|
41
41
|
cvRadioOptTag
|
|
42
42
|
},
|
|
43
43
|
props: {
|
|
44
|
+
value: {
|
|
45
|
+
type: [Number, String],
|
|
46
|
+
default: ''
|
|
47
|
+
},
|
|
48
|
+
modelValue: {
|
|
49
|
+
type: [Number, String],
|
|
50
|
+
default: ''
|
|
51
|
+
},
|
|
44
52
|
type: {
|
|
45
53
|
type: [String],
|
|
46
54
|
default: 'base'
|
|
47
55
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
default: ''
|
|
56
|
+
align: {
|
|
57
|
+
type: [String],
|
|
58
|
+
default: 'left'
|
|
52
59
|
},
|
|
53
60
|
dataType: {
|
|
54
61
|
type: String,
|
|
@@ -56,7 +63,7 @@ export default {
|
|
|
56
63
|
},
|
|
57
64
|
//选项数组
|
|
58
65
|
dataLists: {
|
|
59
|
-
type: [Array, String],
|
|
66
|
+
type: [Array, String, Object],
|
|
60
67
|
default: () => {
|
|
61
68
|
return [];
|
|
62
69
|
}
|
|
@@ -75,6 +82,8 @@ export default {
|
|
|
75
82
|
data() {
|
|
76
83
|
return {
|
|
77
84
|
localVal: '',
|
|
85
|
+
localList: [],
|
|
86
|
+
localStyle: '',
|
|
78
87
|
items: [],
|
|
79
88
|
itemsValue: ''
|
|
80
89
|
};
|
|
@@ -84,21 +93,36 @@ export default {
|
|
|
84
93
|
this.localVal = newVal;
|
|
85
94
|
this._dealValue();
|
|
86
95
|
},
|
|
96
|
+
modelValue(newVal) {
|
|
97
|
+
this.localVal = newVal;
|
|
98
|
+
this._dealValue();
|
|
99
|
+
},
|
|
87
100
|
dataLists(newVal) {
|
|
88
|
-
this.
|
|
101
|
+
this.localList = newVal || [];
|
|
89
102
|
this.items = this.itemsSortOut();
|
|
90
103
|
this._dealValue();
|
|
91
104
|
}
|
|
92
105
|
},
|
|
93
106
|
created() {
|
|
94
|
-
this.localVal = this.
|
|
107
|
+
this.localVal = this.doValueGet();
|
|
95
108
|
if (this.dataLists) {
|
|
109
|
+
this.localList = this.dataLists || [];
|
|
96
110
|
this.items = this.itemsSortOut();
|
|
97
111
|
}
|
|
98
|
-
|
|
112
|
+
// 默认Value
|
|
99
113
|
this._dealValue();
|
|
114
|
+
this._dealStyle();
|
|
100
115
|
},
|
|
101
116
|
methods: {
|
|
117
|
+
doValueGet() {
|
|
118
|
+
if (this.value === '') return this.modelValue;
|
|
119
|
+
if (this.modelValue === '') return this.value;
|
|
120
|
+
return this.value;
|
|
121
|
+
},
|
|
122
|
+
_dealStyle() {
|
|
123
|
+
let alignStyle = this.align == 'right' ? 'flex-end' : 'flex-start';
|
|
124
|
+
this.localStyle = `justify-content:${alignStyle};`;
|
|
125
|
+
},
|
|
102
126
|
_dealValue() {
|
|
103
127
|
//默认Value
|
|
104
128
|
let items = this.items;
|
|
@@ -114,12 +138,10 @@ export default {
|
|
|
114
138
|
},
|
|
115
139
|
itemsSortOut() {
|
|
116
140
|
let original = [];
|
|
117
|
-
original = this.
|
|
118
|
-
|
|
141
|
+
original = this.localList || [];
|
|
119
142
|
if (typeof original == 'string') {
|
|
120
143
|
original = JSON.parse(original);
|
|
121
144
|
}
|
|
122
|
-
|
|
123
145
|
//整理数据
|
|
124
146
|
let items = [];
|
|
125
147
|
let dataValue = this.dataValue ? this.dataValue : 'value';
|
|
@@ -147,6 +169,7 @@ export default {
|
|
|
147
169
|
}
|
|
148
170
|
this.localVal = localVal;
|
|
149
171
|
this.$emit('input', this.localVal);
|
|
172
|
+
this.$emit('update:modelValue', this.localVal);
|
|
150
173
|
}
|
|
151
174
|
}
|
|
152
175
|
};
|
|
@@ -155,7 +178,6 @@ export default {
|
|
|
155
178
|
<style>
|
|
156
179
|
.cv-radio-group-wrap {
|
|
157
180
|
min-height: 35px;
|
|
158
|
-
float: left;
|
|
159
181
|
}
|
|
160
182
|
.cv-radio-group__box {
|
|
161
183
|
display: flex;
|