From e422239791b35a7c466372eda8c99d2775a6bae1 Mon Sep 17 00:00:00 2001 From: wayne <wayne8692wayne8692@gmail.com> Date: 星期六, 22 一月 2022 14:55:51 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/Phase3' into Phase3 --- PAMapp/components/Ui/UiDatePicker.vue | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/PAMapp/components/Ui/UiDatePicker.vue b/PAMapp/components/Ui/UiDatePicker.vue index ef89297..20132bc 100644 --- a/PAMapp/components/Ui/UiDatePicker.vue +++ b/PAMapp/components/Ui/UiDatePicker.vue @@ -8,13 +8,14 @@ format="yyyy/MM/dd" placeholder="������" prefix-icon="icon-down down-icon" + :picker-options="pickerOptions" @change="changeDate" > </el-date-picker> </template> <script lang="ts"> -import { Component, Emit, Prop, Vue, Watch } from "nuxt-property-decorator"; +import { Component, Emit, Prop, PropSync, Vue, Watch } from "nuxt-property-decorator"; @Component export default class UiDatePicker extends Vue { @@ -22,6 +23,9 @@ @Prop() defaultValue!: string; + + @Prop({default: false}) + isPastDateDisabled!: boolean; @Emit('changeDate') changeDate() { @@ -35,5 +39,19 @@ this.changeDate(); } } + + get pickerOptions() { + if (this.isPastDateDisabled) { + return { + disabledDate(time: Date) { + const date = new Date(); + const currentDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`; + const pickedDate = `${time.getFullYear()}/${time.getMonth() + 1}/${time.getDate()}` + return new Date(pickedDate).getTime() < new Date(currentDate).getTime(); + } + } + } + } + } </script> \ No newline at end of file -- Gitblit v1.8.0