Blame view

src/components/date-picker/picker/time-picker.js 874 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 () {
531cd165   梁灏   support DatePicke...
27
          if (!this.currentValue) {
456877a1   梁灏   update TimePicker
28
              if (this.type === 'timerange') {
531cd165   梁灏   support DatePicke...
29
                  this.currentValue = ['',''];
456877a1   梁灏   update TimePicker
30
              } else {
531cd165   梁灏   support DatePicke...
31
                  this.currentValue = '';
456877a1   梁灏   update TimePicker
32
33
34
              }
          }
          this.panel = getPanel(this.type);
9d844d53   梁灏   fixed Layout bug
35
36
      }
  };