Skip to content

Commit

Permalink
fix the bug that the sheet would display blank after clicking now but…
Browse files Browse the repository at this point in the history
…ton and switching from date mode to time mode in date time selection sheet
  • Loading branch information
mayswind committed Apr 5, 2024
1 parent 2229511 commit cb57b21
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/components/mobile/DateTimeSelectionSheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ export default {
}
});
} else {
self.$nextTick(() => {
self.timePickerHolder.setValue(self.timeValues);
});
self.updateTimePicker(true);
}
self.$refs.datetimepicker.switchView('calendar');
Expand All @@ -169,14 +167,15 @@ export default {
this.mode = 'date';
} else {
this.mode = 'time';
this.updateTimePicker(true);
}
},
setCurrentTime() {
this.dateTime = getLocalDatetimeFromUnixTime(getCurrentUnixTime());
this.timeValues = this.getTimeValues(this.dateTime);
if (this.timePickerHolder) {
this.timePickerHolder.setValue(this.timeValues);
if (this.mode === 'time') {
this.updateTimePicker(false);
}
},
confirm() {
Expand Down Expand Up @@ -273,6 +272,21 @@ export default {
}
return ret;
},
updateTimePicker(lazy) {
const self = this;
if (lazy) {
self.$nextTick(() => {
if (self.timePickerHolder) {
self.timePickerHolder.setValue(self.timeValues);
}
});
} else {
if (self.timePickerHolder) {
self.timePickerHolder.setValue(self.timeValues);
}
}
}
}
}
Expand Down

0 comments on commit cb57b21

Please sign in to comment.