17e1fcf1
梁灏
init DatePicker
|
1
2
3
4
5
6
7
8
9
10
11
|
import Picker from '../picker.vue';
import DatePanel from '../panel/date.vue';
import DateRangePanel from '../panel/date-range.vue';
const getPanel = function (type) {
if (type === 'daterange' || type === 'datetimerange') {
return DateRangePanel;
}
return DatePanel;
};
|
0f677893
梁灏
update DatePicker
|
12
13
|
import { oneOf } from '../../../utils/assist';
|
17e1fcf1
梁灏
init DatePicker
|
14
15
16
17
|
export default {
mixins: [Picker],
props: {
type: {
|
0f677893
梁灏
update DatePicker
|
18
19
20
|
validator (value) {
return oneOf(value, ['year', 'month', 'week', 'date', 'daterange', 'datetime', 'datetimerange']);
},
|
17e1fcf1
梁灏
init DatePicker
|
21
|
default: 'date'
|
50637863
梁灏
update DatePicker
|
22
|
},
|
c46f385a
梁灏
update DatePicker
|
23
|
value: {}
|
17e1fcf1
梁灏
init DatePicker
|
24
|
},
|
50637863
梁灏
update DatePicker
|
25
26
27
28
29
30
31
32
33
|
created () {
if (!this.value) {
if (this.type === 'daterange' || this.type === 'datetimerange') {
this.value = ['',''];
} else {
this.value = '';
}
}
|
17e1fcf1
梁灏
init DatePicker
|
34
35
36
|
this.panel = getPanel(this.type);
}
}
|