From 6fa4bba623713c396432ba8b863846883d6a1906 Mon Sep 17 00:00:00 2001 From: wayne <wayne8692wayne8692@gmail.com> Date: 星期三, 26 一月 2022 10:52:23 +0800 Subject: [PATCH] Merge branch 'pollex-dev' into sit --- PAMapp/components/DateTimePicker.vue | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/PAMapp/components/DateTimePicker.vue b/PAMapp/components/DateTimePicker.vue index 7916c77..584df86 100644 --- a/PAMapp/components/DateTimePicker.vue +++ b/PAMapp/components/DateTimePicker.vue @@ -4,25 +4,36 @@ <div class="dateTime"> <UiDatePicker @changeDate="changeDateTime($event, 'date')" + :isPastDateDisabled="isPastDateDisabled" + :isFutureDateDisabled="isFutureDateDisabled" :defaultValue="defaultValue" ></UiDatePicker> <UiTimePicker @changeTime="changeDateTime($event, 'time')" :defaultValue="defaultValue" + :isPastDateDisabled="isPastDateDisabled" + :isFutureDateDisabled="isFutureDateDisabled" + :changeDate="changeDate" ></UiTimePicker> </div> </template> <script lang="ts"> -import { Component, Emit, Prop, Vue } from "nuxt-property-decorator"; +import { Component, Emit, Prop, Vue, Watch } from "nuxt-property-decorator"; @Component export default class DateTimePicker extends Vue { - changeDate!: Date; + changeDate: Date | string = ''; changeTime!: string; @Prop() defaultValue!: string; + + @Prop() + isPastDateDisabled!: boolean; + + @Prop() + isFutureDateDisabled!: boolean; @Emit('changeDateTime') changeDateTime(event, type) { @@ -33,12 +44,14 @@ this.changeTime = event; } if (this.changeDate && this.changeTime) { - const timeArray = this.changeTime.split(':'); - const interViewTime = this.changeDate.setHours(+timeArray[0], +timeArray[1]); + const hour = this.changeTime.split(':')[0]; + const minute = this.changeTime.split(':')[1]; + const interViewTime = new Date(this.changeDate).setHours(+hour, +minute); return new Date(interViewTime); } return ''; } + } </script> -- Gitblit v1.8.0