Skip to content

Commit 0b11182

Browse files
author
cloudIC
committed
fix(picker): change params
1 parent 2ae096e commit 0b11182

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

packages/datetime-picker/src/datetime-picker.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,10 @@
212212
this.selfTriggered = false;
213213
return;
214214
}
215-
this.currentValue = this.getValue(values);
216-
this.handleValueChange();
215+
if (values.length !== 0) {
216+
this.currentValue = this.getValue(values);
217+
this.handleValueChange();
218+
}
217219
},
218220
219221
fillValues(type, start, end) {

packages/picker/src/picker.vue

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,6 @@
9494
9595
created() {
9696
this.$on('slotValueChange', this.slotValueChange);
97-
var slots = this.slots || [];
98-
var values = [];
99-
var valueIndexCount = 0;
100-
slots.forEach(slot => {
101-
if (!slot.divider) {
102-
slot.valueIndex = valueIndexCount++;
103-
values[slot.valueIndex] = (slot.values || [])[slot.defaultIndex || 0];
104-
}
105-
});
106-
this.values = values;
10797
this.slotValueChange();
10898
},
10999
@@ -132,7 +122,7 @@
132122
getSlotValue(index) {
133123
var slot = this.getSlot(index);
134124
if (slot) {
135-
return slot.value;
125+
return slot.currentValue;
136126
}
137127
return null;
138128
},
@@ -175,18 +165,14 @@
175165
get() {
176166
var slots = this.slots || [];
177167
var values = [];
178-
slots.forEach(function(slot) {
179-
if (!slot.divider) values.push(slot.value);
180-
});
181-
182-
return values;
183-
},
184-
set(values) {
185-
var slots = this.slots || [];
186168
var valueIndexCount = 0;
187-
slots.forEach(function(slot) {
188-
if (!slot.divider) slot.value = values[valueIndexCount++];
169+
slots.forEach(slot => {
170+
if (!slot.divider) {
171+
slot.valueIndex = valueIndexCount++;
172+
values[slot.valueIndex] = (slot.values || [])[slot.defaultIndex || 0];
173+
}
189174
});
175+
return values;
190176
}
191177
},
192178
slotCount() {

0 commit comments

Comments
 (0)