比對新檔案 |
| | |
| | | |
| | | |
| | | <template> |
| | | <div class="dateTime"> |
| | | <UiDatePicker |
| | | @changeDate="changeDateTime($event, 'date')" |
| | | :isPastDateDisabled="isPastDateDisabled" |
| | | :isFutureDateDisabled="isFutureDateDisabled" |
| | | :defaultValue="defaultValue" |
| | | ></UiDatePicker> |
| | | <UiTimePicker |
| | | @changeTime="changeDateTime($event, 'time')" |
| | | :defaultValue="defaultValue" |
| | | :isPastDateDisabled="isPastDateDisabled" |
| | | :isFutureDateDisabled="isFutureDateDisabled" |
| | | :changeDate="changeDate" |
| | | ></UiTimePicker> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Component, Emit, Prop, Vue, Watch } from "nuxt-property-decorator"; |
| | | |
| | | @Component |
| | | export default class DateTimePicker extends Vue { |
| | | changeDate: Date | string = ''; |
| | | changeTime!: string; |
| | | |
| | | @Prop() |
| | | defaultValue!: string; |
| | | |
| | | @Prop() |
| | | isPastDateDisabled!: boolean; |
| | | |
| | | @Prop() |
| | | isFutureDateDisabled!: boolean; |
| | | |
| | | @Emit('changeDateTime') |
| | | changeDateTime(event, type) { |
| | | if (type === 'date') { |
| | | this.changeDate = event; |
| | | } |
| | | if (type === 'time') { |
| | | this.changeTime = event; |
| | | } |
| | | if (this.changeDate && this.changeTime) { |
| | | 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> |
| | | |
| | | <style lang="scss" scoped> |
| | | .dateTime { |
| | | display: flex; |
| | | flex-direction: row; |
| | | justify-content: space-between; |
| | | font-size: 20px; |
| | | } |
| | | </style> |