From b1b1fa9058a8e7df07c25cf6d5be1678a042ab7e Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期二, 18 一月 2022 14:27:07 +0800
Subject: [PATCH] update: TODO#134382 [顧問管理流程] 刪除/編輯約訪紀錄

---
 PAMapp/components/Ui/UiTimePicker.vue |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/PAMapp/components/Ui/UiTimePicker.vue b/PAMapp/components/Ui/UiTimePicker.vue
index 3a13512..1fd0de1 100644
--- a/PAMapp/components/Ui/UiTimePicker.vue
+++ b/PAMapp/components/Ui/UiTimePicker.vue
@@ -14,7 +14,7 @@
 </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 UiTimePicker extends Vue {
@@ -25,9 +25,22 @@
         end: '21:00'
     }
 
+    @Prop()
+    defaultValue!: string;
+
     @Emit('changeTime')
     changeTime() {
         return this.timeValue;
     }
+
+    @Watch('defaultValue', {immediate: true})
+    updateDefault() {
+        if (this.defaultValue) {
+            const hours = new Date(this.defaultValue).getHours();
+            const minutes = new Date(this.defaultValue).getMinutes();
+            this.timeValue = `${hours < 10 ? '0' + hours : hours}:${minutes < 10 ? '0' + minutes : minutes}`;
+            this.changeTime();
+        }
+    }
 }
 </script>
\ No newline at end of file

--
Gitblit v1.8.0