From dc0e7366e96ce773ae1690f6db28e03a684bb45e Mon Sep 17 00:00:00 2001 From: Jack <jack.su@pollex.com.tw> Date: 星期二, 18 一月 2022 19:50:12 +0800 Subject: [PATCH] Merge branch 'Phase3' of ssh://dev.pollex.com.tw:29418/pcalife/PAM into Phase3 --- 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