From aecb706f3c17eb36076160d27a0db24525da3ca7 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期六, 22 一月 2022 15:49:07 +0800 Subject: [PATCH] Update : 顧問流程樣式更新 --- PAMapp/components/DateTimePicker.vue | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) diff --git a/PAMapp/components/DateTimePicker.vue b/PAMapp/components/DateTimePicker.vue index 99f4448..f2a8763 100644 --- a/PAMapp/components/DateTimePicker.vue +++ b/PAMapp/components/DateTimePicker.vue @@ -2,18 +2,33 @@ <template> <div class="dateTime"> - <UiDatePicker @changeDate="changeDateTime($event, 'date')"></UiDatePicker> - <UiTimePicker @changeTime="changeDateTime($event, 'time')"></UiTimePicker> + <UiDatePicker + @changeDate="changeDateTime($event, 'date')" + :isPastDateDisabled="isPastDateDisabled" + :defaultValue="defaultValue" + ></UiDatePicker> + <UiTimePicker + @changeTime="changeDateTime($event, 'time')" + :defaultValue="defaultValue" + :isPastDateDisabled="isPastDateDisabled" + :changeDate="changeDate" + ></UiTimePicker> </div> </template> <script lang="ts"> -import { Component, Emit, 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; @Emit('changeDateTime') changeDateTime(event, type) { @@ -24,12 +39,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