Flatten nested repos
This commit is contained in:
66
test/vuex/hs-list/components/oneStartDatePicker.vue
Normal file
66
test/vuex/hs-list/components/oneStartDatePicker.vue
Normal file
@@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<v-menu v-model="menu2" :close-on-content-click="false" :nudge-right="40" lazy transition="scale-transition" offset-y full-width
|
||||
max-width="290px" min-width="290px">
|
||||
<v-text-field slot="activator" v-model="computedStartDateFormatted" :label=init_label persistent-hint readonly browser-autocomplete="off"></v-text-field>
|
||||
<v-date-picker v-model="init_sdate" no-title @input="menu2 = false" :max="init_max_sdate"></v-date-picker>
|
||||
</v-menu>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
props: ['label', 'date', 'data', 'max_sdate'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
init_sdate: this.date && this.date != "0000-00-00" ? this.date : null, //new Date().toISOString().substr(0, 10),
|
||||
init_max_sdate: this.max_sdate ? this.max_sdate : '2999-09-09',
|
||||
dateFormatted: this.formatDate(new Date().toISOString().substr(0, 10)),
|
||||
menu1: false,
|
||||
menu2: false,
|
||||
|
||||
init_label: this.label ? this.label : 'Date',
|
||||
init_sdata: this.data ? this.data : ''
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
computedStartDateFormatted() {
|
||||
return this.formatDate(this.init_sdate)
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
init_sdate(n, o) {
|
||||
this.dateFormatted = this.formatDate(this.init_sdate)
|
||||
|
||||
this.$emit('change', {
|
||||
"old_sdate": o,
|
||||
"new_sdate": n,
|
||||
"data": this.init_sdata
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) {
|
||||
return null
|
||||
}
|
||||
|
||||
const [year, month, day] = date.split('-')
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
parseDate(date) {
|
||||
if (!date) return null
|
||||
|
||||
const [month, day, year] = date.split('/')
|
||||
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
|
||||
},
|
||||
|
||||
emitChange(n, o) {
|
||||
console.log("old:" + o)
|
||||
console.log("new:" + n)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user