Skip to content

Commit 7b51d89

Browse files
committed
Datepicker now emits the md-clear event when cleared, and has the option to not be clearable
1 parent 383b255 commit 7b51d89

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/MdDatepicker/MdDatepicker.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<md-field :class="['md-datepicker', { 'md-native': !this.mdOverrideNative }]" md-clearable>
2+
<md-field :class="['md-datepicker', { 'md-native': !this.mdOverrideNative }]" :md-clearable="mdClearable" @md-clear="onClear">
33
<md-date-icon class="md-date-icon" @click.native="toggleDialog" />
44
<md-input :type="type" ref="input" v-model="inputDate" @focus.native="onFocus" :pattern="pattern" />
55

@@ -65,6 +65,10 @@
6565
MdDebounce: {
6666
type: Number,
6767
default: 1000
68+
},
69+
mdClearable: {
70+
type: Boolean,
71+
default: true
6872
}
6973
},
7074
data: () => ({
@@ -221,6 +225,9 @@
221225
} else {
222226
Vue.util.warn(`The datepicker value is not a valid date. Given value: ${this.value}`)
223227
}
228+
},
229+
onClear() {
230+
this.$emit('md-clear')
224231
}
225232
},
226233
created () {

0 commit comments

Comments
 (0)