2018-01-16 22:24:21 +01:00
|
|
|
|
|
|
|
import { oneOf } from '../../../../utils/assist';
|
|
|
|
import {initTimeDate } from '../../util';
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
confirm: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
showTime: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
format: {
|
|
|
|
type: String,
|
|
|
|
default: 'yyyy-MM-dd'
|
|
|
|
},
|
|
|
|
selectionMode: {
|
|
|
|
type: String,
|
|
|
|
validator (value) {
|
|
|
|
return oneOf(value, ['year', 'month', 'date', 'time']);
|
|
|
|
},
|
|
|
|
default: 'date'
|
|
|
|
},
|
|
|
|
shortcuts: {
|
|
|
|
type: Array,
|
|
|
|
default: () => []
|
|
|
|
},
|
|
|
|
disabledDate: {
|
|
|
|
type: Function,
|
|
|
|
default: () => false
|
|
|
|
},
|
|
|
|
value: {
|
|
|
|
type: Array,
|
|
|
|
default: () => [initTimeDate(), initTimeDate()]
|
2018-01-17 13:05:15 +01:00
|
|
|
},
|
2018-01-17 16:40:38 +01:00
|
|
|
showWeekNumbers: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
2018-01-17 13:05:15 +01:00
|
|
|
startDate: {
|
|
|
|
type: Date
|
2018-01-16 22:24:21 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
isTime(){
|
|
|
|
return this.currentView === 'time';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleToggleTime(){
|
|
|
|
this.currentView = this.currentView === 'time' ? this.selectionMode : 'time';
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|