Blame view

src/components/date-picker/picker/time-picker.js 853 Bytes
9d844d53   梁灏   fixed Layout bug
1
2
  import Picker from '../picker.vue';
  import TimePanel from '../panel/time.vue';
456877a1   梁灏   update TimePicker
3
  import TimeRangePanel from '../panel/time-range.vue';
c1abaed9   梁灏   update TimePicker
4
  import Options from '../time-mixins';
9d844d53   梁灏   fixed Layout bug
5
  
456877a1   梁灏   update TimePicker
6
7
8
9
10
11
12
13
14
  const getPanel = function (type) {
      if (type === 'timerange') {
          return TimeRangePanel;
      }
      return TimePanel;
  };
  
  import { oneOf } from '../../../utils/assist';
  
9d844d53   梁灏   fixed Layout bug
15
  export default {
c1abaed9   梁灏   update TimePicker
16
      mixins: [Picker, Options],
9d844d53   梁灏   fixed Layout bug
17
      props: {
456877a1   梁灏   update TimePicker
18
19
20
21
22
23
          type: {
              validator (value) {
                  return oneOf(value, ['time', 'timerange']);
              },
              default: 'time'
          },
c1abaed9   梁灏   update TimePicker
24
          value: {}
9d844d53   梁灏   fixed Layout bug
25
      },
9d844d53   梁灏   fixed Layout bug
26
      created () {
456877a1   梁灏   update TimePicker
27
28
29
30
31
32
33
34
          if (!this.value) {
              if (this.type === 'timerange') {
                  this.value = ['',''];
              } else {
                  this.value = '';
              }
          }
          this.panel = getPanel(this.type);
9d844d53   梁灏   fixed Layout bug
35
36
      }
  };