@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
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<button class="cv-button-item" :type="type" :form-type="formType" @click="parentClick"><slot /></button>
|
|
4
|
-
</view>
|
|
2
|
+
<button class="cv-button-wrap" :type="type" :form-type="formType" :size="size" @click="parentClick"><slot /></button>
|
|
5
3
|
</template>
|
|
6
|
-
|
|
7
4
|
<script>
|
|
8
5
|
export default {
|
|
9
|
-
name: '
|
|
6
|
+
name: 'cvBtnBase',
|
|
10
7
|
props: {
|
|
11
8
|
size: {
|
|
12
9
|
type: [String],
|
|
@@ -14,7 +11,7 @@ export default {
|
|
|
14
11
|
},
|
|
15
12
|
type: {
|
|
16
13
|
type: [String],
|
|
17
|
-
default: '
|
|
14
|
+
default: 'primary'
|
|
18
15
|
},
|
|
19
16
|
formType: {
|
|
20
17
|
type: [String],
|
|
@@ -22,6 +19,10 @@ export default {
|
|
|
22
19
|
},
|
|
23
20
|
click: {
|
|
24
21
|
type: [Function]
|
|
22
|
+
},
|
|
23
|
+
autoLoading: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
25
26
|
}
|
|
26
27
|
},
|
|
27
28
|
data() {
|
|
@@ -36,6 +37,12 @@ export default {
|
|
|
36
37
|
},
|
|
37
38
|
parentClick(evt) {
|
|
38
39
|
this.$emit('click', evt);
|
|
40
|
+
if (this.autoLoading) {
|
|
41
|
+
this.loadingStatus = true;
|
|
42
|
+
}
|
|
43
|
+
this.$emit('click', () => {
|
|
44
|
+
this.loadingStatus = false;
|
|
45
|
+
});
|
|
39
46
|
}
|
|
40
47
|
}
|
|
41
48
|
};
|
|
@@ -44,15 +51,13 @@ export default {
|
|
|
44
51
|
<style>
|
|
45
52
|
.cv-button-wrap {
|
|
46
53
|
padding: 0 10px;
|
|
47
|
-
margin-top: 10px;
|
|
48
|
-
}
|
|
49
|
-
.cv-button-item {
|
|
50
|
-
letter-spacing: 2px;
|
|
54
|
+
/* margin-top: 10px;
|
|
51
55
|
font-size: 14px;
|
|
52
|
-
margin: 0px 15px;
|
|
53
|
-
line-height: 100%;
|
|
54
|
-
padding:
|
|
55
|
-
|
|
56
|
+
margin: 0px 15px; */
|
|
57
|
+
/* line-height: 100%; */
|
|
58
|
+
/* padding: 6px 5px; */
|
|
59
|
+
/* margin-bottom: 5px; */
|
|
60
|
+
margin: 0 10px;
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
.cv-button-item2 {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="cv-checkbox-group-wrap">
|
|
3
|
-
<checkbox-group @change="checkboxChange" class="cv-
|
|
3
|
+
<checkbox-group @change="checkboxChange" class="cv-checkbox-group__box" :style="localStyle">
|
|
4
4
|
<slot>
|
|
5
5
|
<cv-checkbox-opt-base
|
|
6
6
|
v-if="type == 'base'"
|
|
7
|
-
v-for="item in
|
|
7
|
+
v-for="item in localList"
|
|
8
8
|
:key="item.value"
|
|
9
|
+
:label="item.text"
|
|
9
10
|
:value="item.value"
|
|
10
11
|
:checked="item.checked"
|
|
11
12
|
>
|
|
@@ -13,14 +14,15 @@
|
|
|
13
14
|
</cv-checkbox-opt-base>
|
|
14
15
|
<cv-checkbox-opt-tag
|
|
15
16
|
v-if="type == 'tag'"
|
|
16
|
-
v-for="item in
|
|
17
|
+
v-for="item in localList"
|
|
17
18
|
:key="item.value"
|
|
19
|
+
:label="item.text"
|
|
18
20
|
:value="item.value"
|
|
19
21
|
:checked="item.checked"
|
|
20
22
|
>
|
|
21
23
|
{{ item.text }}
|
|
22
24
|
</cv-checkbox-opt-tag>
|
|
23
|
-
<!-- <label class="cv-checkbox-group__label" v-for="item in
|
|
25
|
+
<!-- <label class="cv-checkbox-group__label" v-for="item in localList" :value="value" :key="item.value">
|
|
24
26
|
<view class="">
|
|
25
27
|
<checkbox :value="item.value" :checked="item.checked" style="transform: scale(0.7)" />
|
|
26
28
|
</view>
|
|
@@ -40,14 +42,21 @@ export default {
|
|
|
40
42
|
cvCheckboxOptTag
|
|
41
43
|
},
|
|
42
44
|
props: {
|
|
45
|
+
value: {
|
|
46
|
+
type: [Array, String, Number],
|
|
47
|
+
default: []
|
|
48
|
+
},
|
|
49
|
+
modelValue: {
|
|
50
|
+
type: [Array, String, Number],
|
|
51
|
+
default: []
|
|
52
|
+
},
|
|
43
53
|
type: {
|
|
44
54
|
type: [String],
|
|
45
55
|
default: 'base'
|
|
46
56
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
default: []
|
|
57
|
+
align: {
|
|
58
|
+
type: [String],
|
|
59
|
+
default: 'left'
|
|
51
60
|
},
|
|
52
61
|
dataType: {
|
|
53
62
|
type: String,
|
|
@@ -82,29 +91,45 @@ export default {
|
|
|
82
91
|
data() {
|
|
83
92
|
return {
|
|
84
93
|
localVal: [],
|
|
85
|
-
|
|
94
|
+
localList: [],
|
|
95
|
+
localStyle: ''
|
|
86
96
|
};
|
|
87
97
|
},
|
|
88
98
|
watch: {
|
|
89
99
|
value(newVal) {
|
|
90
|
-
this.
|
|
100
|
+
this.dealValue(newVal);
|
|
101
|
+
},
|
|
102
|
+
modelValue(newVal) {
|
|
103
|
+
this.dealValue(newVal);
|
|
91
104
|
},
|
|
92
105
|
dataLists(newVal) {
|
|
93
|
-
this.
|
|
94
|
-
this.items = this.itemsSortOut();
|
|
95
|
-
// this._dealValue();
|
|
106
|
+
this.localList = this.dealDataList(newVal || []);
|
|
96
107
|
}
|
|
97
108
|
},
|
|
98
109
|
created() {
|
|
99
|
-
this.
|
|
110
|
+
this.dealValue(this.doValueGet());
|
|
100
111
|
if (this.maxNumber > 0) {
|
|
101
112
|
this.message = '最多只能选择' + this.maxNumber + '个';
|
|
102
113
|
}
|
|
103
|
-
this.
|
|
114
|
+
this.localList = this.dealDataList(this.dataLists) || [];
|
|
115
|
+
this._dealStyle();
|
|
104
116
|
},
|
|
105
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
|
+
},
|
|
127
|
+
_dealStyle() {
|
|
128
|
+
let alignStyle = this.align == 'right' ? 'flex-end' : 'flex-start';
|
|
129
|
+
this.localStyle = `justify-content:${alignStyle};`;
|
|
130
|
+
},
|
|
106
131
|
// 处理传递的内容问题,全部转成数组
|
|
107
|
-
|
|
132
|
+
dealValue(oldVal) {
|
|
108
133
|
let newVal = [];
|
|
109
134
|
if (Object.prototype.toString.call(oldVal) == '[object String]') {
|
|
110
135
|
if (oldVal != '') {
|
|
@@ -115,17 +140,19 @@ export default {
|
|
|
115
140
|
newVal = oldVal;
|
|
116
141
|
}
|
|
117
142
|
}
|
|
143
|
+
for (let i in newVal) {
|
|
144
|
+
if (typeof newVal[i] == 'number') {
|
|
145
|
+
newVal[i] = newVal[i].toString();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
118
148
|
this.localVal = newVal;
|
|
119
|
-
console.log(this.localVal);
|
|
120
149
|
},
|
|
121
|
-
|
|
150
|
+
dealDataList(oldList) {
|
|
122
151
|
let original = [];
|
|
123
|
-
original =
|
|
124
|
-
|
|
152
|
+
original = oldList || [];
|
|
125
153
|
if (typeof original == 'string') {
|
|
126
154
|
original = JSON.parse(original);
|
|
127
155
|
}
|
|
128
|
-
|
|
129
156
|
//整理数据
|
|
130
157
|
let items = [];
|
|
131
158
|
let dataValue = this.dataValue ? this.dataValue : 'value';
|
|
@@ -133,62 +160,67 @@ export default {
|
|
|
133
160
|
let dataChecked = this.dataChecked ? this.dataChecked : 'checked';
|
|
134
161
|
let i = 0;
|
|
135
162
|
for (i in original) {
|
|
136
|
-
let
|
|
137
|
-
let
|
|
138
|
-
let
|
|
139
|
-
let
|
|
140
|
-
if (typeof
|
|
141
|
-
|
|
163
|
+
let itemData = original[i];
|
|
164
|
+
let itemChecked = false;
|
|
165
|
+
let itemText = itemData[dataText];
|
|
166
|
+
let itemValue = itemData[dataValue];
|
|
167
|
+
if (typeof itemValue == 'number') {
|
|
168
|
+
itemValue = itemValue.toString();
|
|
142
169
|
}
|
|
143
|
-
if (
|
|
144
|
-
|
|
170
|
+
if (itemData[dataChecked] == true) {
|
|
171
|
+
itemChecked = true;
|
|
145
172
|
}
|
|
146
173
|
let localVal = this.localVal || [];
|
|
147
174
|
// let tempLocalVal = localVal.split(',');
|
|
148
175
|
//写入已选选项
|
|
149
176
|
for (const ii in localVal) {
|
|
150
177
|
if (this.dataType == 'text') {
|
|
151
|
-
if (localVal[ii] ==
|
|
152
|
-
|
|
178
|
+
if (localVal[ii] == itemText) {
|
|
179
|
+
itemChecked = true;
|
|
153
180
|
}
|
|
154
181
|
} else {
|
|
155
|
-
if (localVal[ii] ==
|
|
156
|
-
|
|
182
|
+
if (localVal[ii] == itemValue) {
|
|
183
|
+
itemChecked = true;
|
|
157
184
|
}
|
|
158
185
|
}
|
|
159
186
|
}
|
|
160
187
|
items.push({
|
|
161
|
-
value:
|
|
162
|
-
text:
|
|
163
|
-
checked:
|
|
188
|
+
value: itemValue,
|
|
189
|
+
text: itemText,
|
|
190
|
+
checked: itemChecked
|
|
164
191
|
});
|
|
165
192
|
}
|
|
166
193
|
return items;
|
|
167
194
|
},
|
|
168
195
|
checkboxChange(e) {
|
|
169
|
-
let items = this.
|
|
196
|
+
let items = this.localList;
|
|
170
197
|
let values = e.detail.value;
|
|
171
|
-
this.$emit('input', values);
|
|
172
|
-
console.log(values);
|
|
173
|
-
for (var i = 0, lenI = items.length; i < lenI; ++i) {
|
|
174
|
-
const item = items[i];
|
|
175
|
-
if (values.includes(item.value)) {
|
|
176
|
-
this.$set(item, 'checked', true);
|
|
177
|
-
} else {
|
|
178
|
-
this.$set(item, 'checked', false);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
// console.log(items);
|
|
182
|
-
|
|
183
198
|
let localVal = [];
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
199
|
+
if (items && Array.prototype.isPrototypeOf(items) && items.length > 0) {
|
|
200
|
+
for (var i = 0, lenI = items.length; i < lenI; ++i) {
|
|
201
|
+
const item = items[i];
|
|
202
|
+
if (values.includes(item.value)) {
|
|
203
|
+
this.$set(item, 'checked', true);
|
|
188
204
|
} else {
|
|
189
|
-
|
|
205
|
+
this.$set(item, 'checked', false);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
for (let i in items) {
|
|
209
|
+
if (items[i].checked) {
|
|
210
|
+
if (this.dataType == 'text') {
|
|
211
|
+
localVal.push(items[i].text);
|
|
212
|
+
} else {
|
|
213
|
+
localVal.push(items[i].value);
|
|
214
|
+
}
|
|
190
215
|
}
|
|
191
216
|
}
|
|
217
|
+
} else {
|
|
218
|
+
localVal = values;
|
|
219
|
+
}
|
|
220
|
+
for (let i in localVal) {
|
|
221
|
+
if (typeof localVal[i] == 'number') {
|
|
222
|
+
localVal[i] = localVal[i].toString();
|
|
223
|
+
}
|
|
192
224
|
}
|
|
193
225
|
if (this.maxNumber !== 0 && localVal.length > this.maxNumber) {
|
|
194
226
|
this.messageDisplay = true;
|
|
@@ -196,8 +228,9 @@ export default {
|
|
|
196
228
|
this.messageDisplay = false;
|
|
197
229
|
}
|
|
198
230
|
// this.localVal = localVal;
|
|
199
|
-
//
|
|
200
|
-
|
|
231
|
+
// console.log('--checkboxChange--', items, values, this.localVal);
|
|
232
|
+
this.$emit('input', localVal);
|
|
233
|
+
this.$emit('update:modelValue', localVal);
|
|
201
234
|
}
|
|
202
235
|
}
|
|
203
236
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="cv-checkbox-opt-base">
|
|
3
3
|
<label class="cv-checkbox-opt__label">
|
|
4
|
-
<checkbox :value="localVal" :checked="
|
|
4
|
+
<checkbox :value="localVal" :checked="localChecked" style="transform: scale(0.7)" />
|
|
5
5
|
<view>
|
|
6
6
|
<slot>{{ label }}</slot>
|
|
7
7
|
</view>
|
|
@@ -27,18 +27,58 @@ 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
|
+
if (Object.prototype.toString.call(newVal) == '[object Array]') {
|
|
44
|
+
if (this.parentObj && this.parentObj.dataType == 'text') {
|
|
45
|
+
this.localChecked = newVal.includes(this.label) ? true : false;
|
|
46
|
+
} else if (this.parentObj && this.parentObj.dataType == 'value') {
|
|
47
|
+
this.localChecked = newVal.includes(this.localVal) ? true : false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
36
50
|
}
|
|
37
51
|
},
|
|
38
52
|
created() {
|
|
39
53
|
this.localVal = String(this.value);
|
|
54
|
+
this.localChecked = this.checked;
|
|
55
|
+
console.log('---', this.localVal, this.localChecked);
|
|
56
|
+
},
|
|
57
|
+
mounted() {
|
|
58
|
+
this.parentObj = this.getParent();
|
|
40
59
|
},
|
|
41
|
-
methods: {
|
|
60
|
+
methods: {
|
|
61
|
+
funcOnClick() {
|
|
62
|
+
// let parentObj = this.getParent();
|
|
63
|
+
// console.log(parentObj.$children);
|
|
64
|
+
// let { value } = parentObj;
|
|
65
|
+
// console.log(value, this.localVal);
|
|
66
|
+
// this.localChecked = newVal == this.value ? true : false;
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* 获取父元素实例
|
|
70
|
+
*/
|
|
71
|
+
getParent(name = 'cvCheckboxGroup') {
|
|
72
|
+
let parent = this.$parent;
|
|
73
|
+
let parentName = parent.$options.name;
|
|
74
|
+
while (parentName !== name) {
|
|
75
|
+
parent = parent.$parent;
|
|
76
|
+
if (!parent) return false;
|
|
77
|
+
parentName = parent.$options.name;
|
|
78
|
+
}
|
|
79
|
+
return parent;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
42
82
|
};
|
|
43
83
|
</script>
|
|
44
84
|
<style>
|
|
@@ -39,9 +39,13 @@ export default {
|
|
|
39
39
|
checked(newVal) {
|
|
40
40
|
this.localChecked = newVal;
|
|
41
41
|
},
|
|
42
|
-
'parentObj.
|
|
42
|
+
'parentObj.localVal'(newVal) {
|
|
43
43
|
if (Object.prototype.toString.call(newVal) == '[object Array]') {
|
|
44
|
-
this.
|
|
44
|
+
if (this.parentObj && this.parentObj.dataType == 'text') {
|
|
45
|
+
this.localChecked = newVal.includes(this.label) ? true : false;
|
|
46
|
+
} else if (this.parentObj && this.parentObj.dataType == 'value') {
|
|
47
|
+
this.localChecked = newVal.includes(this.localVal) ? true : false;
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
},
|
|
@@ -34,14 +34,15 @@ export default {
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
props: {
|
|
37
|
-
maxlength: {
|
|
38
|
-
type: [Number, String],
|
|
39
|
-
default: -1
|
|
40
|
-
},
|
|
41
37
|
value: {
|
|
42
38
|
type: [Number, String],
|
|
43
39
|
default: ''
|
|
44
40
|
},
|
|
41
|
+
modelValue: {},
|
|
42
|
+
maxlength: {
|
|
43
|
+
type: [Number, String],
|
|
44
|
+
default: -1
|
|
45
|
+
},
|
|
45
46
|
mobile: {
|
|
46
47
|
type: [Number, String],
|
|
47
48
|
default: ''
|
|
@@ -181,6 +182,7 @@ export default {
|
|
|
181
182
|
},
|
|
182
183
|
funcOnInput(e) {
|
|
183
184
|
this.$emit('input', this.localVal);
|
|
185
|
+
this.$emit('update:modelValue', this.localVal);
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
};
|
|
@@ -16,11 +16,8 @@
|
|
|
16
16
|
</picker>
|
|
17
17
|
</view>
|
|
18
18
|
</template>
|
|
19
|
-
|
|
20
19
|
<script>
|
|
21
|
-
import MixinsPicker from '../mixins/mixins-picker.js';
|
|
22
20
|
export default {
|
|
23
|
-
mixins: [MixinsPicker],
|
|
24
21
|
name: 'cvPickerDate',
|
|
25
22
|
props: {
|
|
26
23
|
//默认输入框
|
|
@@ -28,6 +25,10 @@ export default {
|
|
|
28
25
|
type: String,
|
|
29
26
|
default: ''
|
|
30
27
|
},
|
|
28
|
+
modelValue: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
31
32
|
startDate: {
|
|
32
33
|
type: String,
|
|
33
34
|
default: ''
|
|
@@ -39,11 +40,19 @@ export default {
|
|
|
39
40
|
fields: {
|
|
40
41
|
type: String,
|
|
41
42
|
default: 'day'
|
|
43
|
+
},
|
|
44
|
+
// 占位符
|
|
45
|
+
placeholder: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '请选择'
|
|
42
48
|
}
|
|
43
49
|
},
|
|
44
50
|
watch: {
|
|
45
|
-
value(
|
|
46
|
-
this.localVal =
|
|
51
|
+
value(newVal) {
|
|
52
|
+
this.localVal = newVal;
|
|
53
|
+
},
|
|
54
|
+
modelValue(newVal) {
|
|
55
|
+
this.localVal = newVal;
|
|
47
56
|
}
|
|
48
57
|
},
|
|
49
58
|
data() {
|
|
@@ -53,13 +62,25 @@ export default {
|
|
|
53
62
|
};
|
|
54
63
|
},
|
|
55
64
|
created() {
|
|
56
|
-
this.localVal = this.
|
|
65
|
+
this.localVal = this.doValueGet();
|
|
57
66
|
},
|
|
58
67
|
methods: {
|
|
68
|
+
doValueGet() {
|
|
69
|
+
if (this.value === '') return this.modelValue;
|
|
70
|
+
if (this.modelValue === '') return this.value;
|
|
71
|
+
return this.value;
|
|
72
|
+
},
|
|
59
73
|
bindDateChange: function (e) {
|
|
74
|
+
this.iconTop = false;
|
|
60
75
|
this.localVal = e.detail.value;
|
|
61
76
|
this.$emit('input', this.localVal);
|
|
77
|
+
this.$emit('update:modelValue', this.localVal);
|
|
78
|
+
},
|
|
79
|
+
bindPickerCancel() {
|
|
62
80
|
this.iconTop = false;
|
|
81
|
+
},
|
|
82
|
+
changeIconTop() {
|
|
83
|
+
this.iconTop = true;
|
|
63
84
|
}
|
|
64
85
|
}
|
|
65
86
|
};
|
|
@@ -29,11 +29,8 @@
|
|
|
29
29
|
</picker>
|
|
30
30
|
</view>
|
|
31
31
|
</template>
|
|
32
|
-
|
|
33
32
|
<script>
|
|
34
|
-
import MixinsPicker from '../mixins/mixins-picker.js';
|
|
35
33
|
export default {
|
|
36
|
-
mixins: [MixinsPicker],
|
|
37
34
|
name: 'cvPickerDatetime',
|
|
38
35
|
props: {
|
|
39
36
|
//默认输入框
|
|
@@ -60,11 +57,17 @@ export default {
|
|
|
60
57
|
fields: {
|
|
61
58
|
type: String,
|
|
62
59
|
default: 'day'
|
|
60
|
+
},
|
|
61
|
+
// 占位符
|
|
62
|
+
placeholder: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '请选择'
|
|
63
65
|
}
|
|
64
66
|
},
|
|
65
67
|
watch: {
|
|
66
|
-
value(
|
|
68
|
+
value(newVal) {
|
|
67
69
|
this.localVal = this.value;
|
|
70
|
+
this.localVal = newVal;
|
|
68
71
|
this.localVal_date = this.localVal.split(' ')[0] || '';
|
|
69
72
|
this.localVal_time = this.localVal.split(' ')[1] || '';
|
|
70
73
|
}
|
|
@@ -93,10 +96,17 @@ export default {
|
|
|
93
96
|
this.localVal_date = value;
|
|
94
97
|
this.mergeDateTime();
|
|
95
98
|
},
|
|
99
|
+
bindPickerCancel() {
|
|
100
|
+
this.iconTop = false;
|
|
101
|
+
},
|
|
96
102
|
mergeDateTime() {
|
|
97
103
|
this.localVal = this.localVal_date + ' ' + this.localVal_time;
|
|
98
|
-
this.$emit('input', this.localVal);
|
|
99
104
|
this.iconTop = false;
|
|
105
|
+
this.$emit('input', this.localVal);
|
|
106
|
+
this.$emit('update:modelValue', this.localVal);
|
|
107
|
+
},
|
|
108
|
+
changeIconTop() {
|
|
109
|
+
this.iconTop = true;
|
|
100
110
|
}
|
|
101
111
|
}
|
|
102
112
|
};
|
|
@@ -17,19 +17,18 @@
|
|
|
17
17
|
</picker>
|
|
18
18
|
</view>
|
|
19
19
|
</template>
|
|
20
|
-
|
|
21
20
|
<script>
|
|
22
|
-
import MixinsPicker from '../mixins/mixins-picker.js';
|
|
23
21
|
export default {
|
|
24
|
-
mixins: [MixinsPicker],
|
|
25
22
|
name: 'cvPickerDatetime5',
|
|
26
23
|
props: {
|
|
27
24
|
//默认输入框内容
|
|
28
25
|
value: {
|
|
29
26
|
type: String,
|
|
30
|
-
default:
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
default: ''
|
|
28
|
+
},
|
|
29
|
+
modelValue: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ''
|
|
33
32
|
},
|
|
34
33
|
dataType: {
|
|
35
34
|
type: String,
|
|
@@ -46,12 +45,21 @@ export default {
|
|
|
46
45
|
end: {
|
|
47
46
|
type: String,
|
|
48
47
|
default: ''
|
|
48
|
+
},
|
|
49
|
+
// 占位符
|
|
50
|
+
placeholder: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: '请选择'
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
55
|
watch: {
|
|
52
56
|
value(newVal) {
|
|
53
57
|
this.localVal = newVal;
|
|
54
58
|
this.itemsSortOut();
|
|
59
|
+
},
|
|
60
|
+
modelValue(newVal) {
|
|
61
|
+
this.localVal = newVal;
|
|
62
|
+
this.itemsSortOut();
|
|
55
63
|
}
|
|
56
64
|
},
|
|
57
65
|
data() {
|
|
@@ -74,7 +82,7 @@ export default {
|
|
|
74
82
|
};
|
|
75
83
|
},
|
|
76
84
|
created() {
|
|
77
|
-
this.localVal = this.
|
|
85
|
+
this.localVal = this.doValueGet();
|
|
78
86
|
this.localDataType = this.dataType != 'value' ? 'text' : 'value';
|
|
79
87
|
this.localJoint = this.joint;
|
|
80
88
|
|
|
@@ -84,6 +92,11 @@ export default {
|
|
|
84
92
|
this.itemsSortOut();
|
|
85
93
|
},
|
|
86
94
|
methods: {
|
|
95
|
+
doValueGet() {
|
|
96
|
+
if (this.value === '') return this.modelValue;
|
|
97
|
+
if (this.modelValue === '') return this.value;
|
|
98
|
+
return this.value;
|
|
99
|
+
},
|
|
87
100
|
initReginData(data) {
|
|
88
101
|
let localData = [];
|
|
89
102
|
for (const key in data) {
|
|
@@ -377,6 +390,9 @@ export default {
|
|
|
377
390
|
this.updatelocalVal();
|
|
378
391
|
this.iconTop = false;
|
|
379
392
|
},
|
|
393
|
+
changeIconTop() {
|
|
394
|
+
this.iconTop = true;
|
|
395
|
+
},
|
|
380
396
|
/* 取消选择 */
|
|
381
397
|
onCancel(e) {
|
|
382
398
|
this.iconTop = false;
|
|
@@ -444,6 +460,7 @@ export default {
|
|
|
444
460
|
':' +
|
|
445
461
|
lastDatetimeArr[4];
|
|
446
462
|
this.$emit('input', this.localVal);
|
|
463
|
+
this.$emit('update:modelValue', this.localVal);
|
|
447
464
|
}
|
|
448
465
|
}
|
|
449
466
|
};
|
|
@@ -61,6 +61,7 @@ export default {
|
|
|
61
61
|
this.shareClass = 'show';
|
|
62
62
|
this.localIsShow = 1;
|
|
63
63
|
this.$emit('input', this.localIsShow);
|
|
64
|
+
this.$emit('update:modelValue', this.localIsShow);
|
|
64
65
|
},
|
|
65
66
|
shareDiaHide() {
|
|
66
67
|
this.shareClass = 'hide';
|
|
@@ -69,6 +70,7 @@ export default {
|
|
|
69
70
|
this.shareClass = 'none';
|
|
70
71
|
}, 150);
|
|
71
72
|
this.$emit('input', this.localIsShow);
|
|
73
|
+
this.$emit('update:modelValue', this.localIsShow);
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
};
|