Blame view

src/components/date-picker/base/confirm.vue 1.36 KB
b9041a0d   梁灏   DatePicker add co...
1
2
  <template>
      <div :class="[prefixCls + '-confirm']">
2dc27713   梁灏   update DateTimePi...
3
          <span :class="timeClasses" v-if="showTime" @click="handleToggleTime">
5cc9b892   梁灏   update DateTimePi...
4
5
6
              <template v-if="isTime">选择日期</template>
              <template v-else>选择时间</template>
          </span>
b9041a0d   梁灏   DatePicker add co...
7
8
9
10
11
12
13
14
15
16
17
          <i-button size="small" type="text" @click="handleClear">清空</i-button>
          <i-button size="small" type="primary" @click="handleSuccess">确定</i-button>
      </div>
  </template>
  <script>
      import iButton from '../../button/button.vue';
  
      const prefixCls = 'ivu-picker';
  
      export default {
          components: { iButton },
5cc9b892   梁灏   update DateTimePi...
18
19
          props: {
              showTime: false,
2dc27713   梁灏   update DateTimePi...
20
21
              isTime: false,
              timeDisabled: false
5cc9b892   梁灏   update DateTimePi...
22
          },
b9041a0d   梁灏   DatePicker add co...
23
24
25
          data () {
              return {
                  prefixCls: prefixCls
b0893113   jingsam   :art: add eslint
26
              };
b9041a0d   梁灏   DatePicker add co...
27
          },
2dc27713   梁灏   update DateTimePi...
28
29
30
31
32
33
34
          computed: {
              timeClasses () {
                  return {
                      [`${prefixCls}-confirm-time-disabled`]: this.timeDisabled
                  };
              }
          },
b9041a0d   梁灏   DatePicker add co...
35
36
37
38
39
40
          methods: {
              handleClear () {
                  this.$emit('on-pick-clear');
              },
              handleSuccess () {
                  this.$emit('on-pick-success');
5cc9b892   梁灏   update DateTimePi...
41
42
              },
              handleToggleTime () {
2dc27713   梁灏   update DateTimePi...
43
                  if (this.timeDisabled) return;
5cc9b892   梁灏   update DateTimePi...
44
                  this.$emit('on-pick-toggle-time');
b9041a0d   梁灏   DatePicker add co...
45
46
              }
          }
b0893113   jingsam   :art: add eslint
47
48
      };
  </script>