From c8c18ece009bafdcac9ed73446d8c2d4fbbf3256 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期三, 19 一月 2022 09:16:20 +0800
Subject: [PATCH] fixed TODO#134382 新增約訪紀錄:  "defaultValue" is not defined error

---
 PAMapp/components/Ui/UiDatePicker.vue |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/PAMapp/components/Ui/UiDatePicker.vue b/PAMapp/components/Ui/UiDatePicker.vue
index 56bdc58..8752761 100644
--- a/PAMapp/components/Ui/UiDatePicker.vue
+++ b/PAMapp/components/Ui/UiDatePicker.vue
@@ -14,15 +14,26 @@
 </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 UiDatePicker extends Vue {
-    dateValue = '';
+    dateValue: Date | string = '';
+
+    @Prop()
+    defaultValue!: string;
 
     @Emit('changeDate')
     changeDate() {
         return this.dateValue;
     }
+
+    @Watch('defaultValue', {immediate: true})
+    updateDefault() {
+        if (this.defaultValue) {
+            this.dateValue = new Date(this.defaultValue);
+            this.changeDate();
+        }
+    }
 }
 </script>
\ No newline at end of file

--
Gitblit v1.8.0