date-picker.js
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import Picker from '../picker.vue';
import DatePickerPanel from '../panel/Date/date.vue';
import RangeDatePickerPanel from '../panel/Date/date-range.vue';
import { oneOf } from '../../../utils/assist';
export default {
mixins: [Picker],
props: {
type: {
validator (value) {
return oneOf(value, ['year', 'month', 'date', 'daterange', 'datetime', 'datetimerange']);
},
default: 'date'
},
},
components: { DatePickerPanel, RangeDatePickerPanel },
computed: {
panel(){
const isRange = this.type === 'daterange' || this.type === 'datetimerange';
return isRange ? 'RangeDatePickerPanel' : 'DatePickerPanel';
},
ownPickerProps(){
return {};
}
},
/*
created () {
if (!this.currentValue) {
if (this.type === 'daterange' || this.type === 'datetimerange') {
this.currentValue = ['',''];
} else {
this.currentValue = '';
}
}
}
*/
};