Skip to content

Commit

Permalink
Datepicker now emits the md-clear event when cleared, and has the opt…
Browse files Browse the repository at this point in the history
…ion to not be clearable
  • Loading branch information
shiragold committed Nov 11, 2018
1 parent 383b255 commit 7b51d89
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/MdDatepicker/MdDatepicker.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<md-field :class="['md-datepicker', { 'md-native': !this.mdOverrideNative }]" md-clearable>
<md-field :class="['md-datepicker', { 'md-native': !this.mdOverrideNative }]" :md-clearable="mdClearable" @md-clear="onClear">
<md-date-icon class="md-date-icon" @click.native="toggleDialog" />
<md-input :type="type" ref="input" v-model="inputDate" @focus.native="onFocus" :pattern="pattern" />

Expand Down Expand Up @@ -65,6 +65,10 @@
MdDebounce: {
type: Number,
default: 1000
},
mdClearable: {
type: Boolean,
default: true
}
},
data: () => ({
Expand Down Expand Up @@ -221,6 +225,9 @@
} else {
Vue.util.warn(`The datepicker value is not a valid date. Given value: ${this.value}`)
}
},
onClear() {
this.$emit('md-clear')
}
},
created () {
Expand Down

0 comments on commit 7b51d89

Please sign in to comment.