| | |
| | | type="date" |
| | | format="yyyy/MM/dd" |
| | | placeholder="選擇日期" |
| | | prefix-icon="icon-down" |
| | | prefix-icon="icon-down down-icon" |
| | | @change="changeDate" |
| | | > |
| | | </el-date-picker> |
| | | </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> |