Add a disabled property to the datepicker
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
590edc4f82
commit
68c48b5792
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="datepicker">
|
<div class="datepicker" :class="{'disabled': disabled}">
|
||||||
<a @click.stop="show = !show" class="show">
|
<a @click.stop="toggleDatePopup" class="show">
|
||||||
<template v-if="date === null">
|
<template v-if="date === null">
|
||||||
{{ chooseDateLabel }}
|
{{ chooseDateLabel }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -140,6 +140,10 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'Choose a date'
|
default: 'Choose a date'
|
||||||
},
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.date = this.value
|
this.date = this.value
|
||||||
|
@ -162,6 +166,13 @@ export default {
|
||||||
this.$emit('input', this.date)
|
this.$emit('input', this.date)
|
||||||
this.$emit('change', this.date)
|
this.$emit('change', this.date)
|
||||||
},
|
},
|
||||||
|
toggleDatePopup() {
|
||||||
|
if(this.disabled) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.show = !this.show
|
||||||
|
},
|
||||||
hideDatePopup(e) {
|
hideDatePopup(e) {
|
||||||
if (this.show) {
|
if (this.show) {
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.disabled a {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
.datepicker-popup {
|
.datepicker-popup {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
|
|
|
@ -73,6 +73,10 @@
|
||||||
background: $white;
|
background: $white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.disabled a.show:hover {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
|
|
Reference in New Issue