Blame view

src/components/date-picker/picker/date-picker.js 1.05 KB
17e1fcf1   梁灏   init DatePicker
1
  import Picker from '../picker.vue';
95eae081   Sergio Crisostomo   refactor Datepicker
2
3
  import DatePickerPanel from '../panel/Date/date.vue';
  import RangeDatePickerPanel from '../panel/Date/date-range.vue';
17e1fcf1   梁灏   init DatePicker
4
  
0f677893   梁灏   update DatePicker
5
6
  import { oneOf } from '../../../utils/assist';
  
17e1fcf1   梁灏   init DatePicker
7
8
9
10
  export default {
      mixins: [Picker],
      props: {
          type: {
0f677893   梁灏   update DatePicker
11
              validator (value) {
e0cd7f90   梁灏   fixed #134
12
                  return oneOf(value, ['year', 'month', 'date', 'daterange', 'datetime', 'datetimerange']);
0f677893   梁灏   update DatePicker
13
              },
17e1fcf1   梁灏   init DatePicker
14
              default: 'date'
50637863   梁灏   update DatePicker
15
          },
17e1fcf1   梁灏   init DatePicker
16
      },
95eae081   Sergio Crisostomo   refactor Datepicker
17
18
19
20
21
22
23
24
      components: { DatePickerPanel, RangeDatePickerPanel },
      computed: {
          panel(){
              const isRange =  this.type === 'daterange' || this.type === 'datetimerange';
              return isRange ? 'RangeDatePickerPanel' : 'DatePickerPanel';
          },
          ownPickerProps(){
              return {};
9ffdd6da   Sergio Crisostomo   Propagate type ch...
25
26
          }
      },
95eae081   Sergio Crisostomo   refactor Datepicker
27
  /*
50637863   梁灏   update DatePicker
28
      created () {
531cd165   梁灏   support DatePicke...
29
          if (!this.currentValue) {
50637863   梁灏   update DatePicker
30
              if (this.type === 'daterange' || this.type === 'datetimerange') {
531cd165   梁灏   support DatePicke...
31
                  this.currentValue = ['',''];
50637863   梁灏   update DatePicker
32
              } else {
531cd165   梁灏   support DatePicke...
33
                  this.currentValue = '';
50637863   梁灏   update DatePicker
34
35
              }
          }
17e1fcf1   梁灏   init DatePicker
36
      }
95eae081   Sergio Crisostomo   refactor Datepicker
37
  */
b0893113   jingsam   :art: add eslint
38
  };