fix: update date picker (#17)

This commit is contained in:
Fine0830 2022-02-21 20:17:13 +08:00 committed by GitHub
parent 01194b0325
commit 7fe0a57e49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -351,7 +351,7 @@ watch(
}
);
const parse = (num: number): number => {
return Math.floor(num / 1000);
return num / 100000;
};
const start = computed(() => {
return parse(Number(props.dates[0]));
@ -547,10 +547,12 @@ const ok = (info: any) => {
state.minute,
state.second
);
if (props.left && Math.floor(_time.getTime() / 1000) > end.value) {
emit("setDates", _time);
if (props.left && _time.getTime() / 100000 < end.value) {
emit("setDates", _time, "left");
}
if (props.right && _time.getTime() / 100000 > start.value) {
emit("setDates", _time, "right");
}
emit("input", _time);
emit("ok", info === "h");
};
onMounted(() => {

View File

@ -275,7 +275,11 @@ const ok = (leaveOpened: boolean) => {
show.value = range.value;
}, 1);
};
const setDates = (d: Date) => {
const setDates = (d: Date, pos: string) => {
if (pos === "left") {
dates.value[0] = d;
return;
}
dates.value[1] = d;
};
const dc = (e: any) => {