Blame view

src/components/spin/spin.vue 2.29 KB
7fa943eb   梁灏   init
1
  <template>
2d43f26b   梁灏   support Spin
2
      <transition name="fade">
297648f1   梁灏   fixed #1063
3
          <div :class="classes" v-if="fullscreenVisible">
2d43f26b   梁灏   support Spin
4
5
6
7
              <div :class="mainClasses">
                  <span :class="dotClasses"></span>
                  <div :class="textClasses"><slot></slot></div>
              </div>
7fa943eb   梁灏   init
8
          </div>
2d43f26b   梁灏   support Spin
9
      </transition>
7fa943eb   梁灏   init
10
11
12
  </template>
  <script>
      import { oneOf } from '../../utils/assist';
297648f1   梁灏   fixed #1063
13
      import ScrollbarMixins from '../modal/mixins-scrollbar';
7fa943eb   梁灏   init
14
15
16
17
  
      const prefixCls = 'ivu-spin';
  
      export default {
47a7f21d   梁灏   support Cascader
18
          name: 'Spin',
297648f1   梁灏   fixed #1063
19
          mixins: [ ScrollbarMixins ],
7fa943eb   梁灏   init
20
21
22
23
24
25
26
27
28
          props: {
              size: {
                  validator (value) {
                      return oneOf(value, ['small', 'large']);
                  }
              },
              fix: {
                  type: Boolean,
                  default: false
297648f1   梁灏   fixed #1063
29
30
31
32
              },
              fullscreen: {
                  type: Boolean,
                  default: false
7fa943eb   梁灏   init
33
34
35
36
              }
          },
          data () {
              return {
297648f1   梁灏   fixed #1063
37
38
39
                  showText: false,
                  // used for $Spin
                  visible: false
b0893113   jingsam   :art: add eslint
40
              };
7fa943eb   梁灏   init
41
42
43
44
45
46
47
48
49
          },
          computed: {
              classes () {
                  return [
                      `${prefixCls}`,
                      {
                          [`${prefixCls}-${this.size}`]: !!this.size,
                          [`${prefixCls}-fix`]: this.fix,
                          [`${prefixCls}-show-text`]: this.showText,
297648f1   梁灏   fixed #1063
50
                          [`${prefixCls}-fullscreen`]: this.fullscreen
7fa943eb   梁灏   init
51
                      }
b0893113   jingsam   :art: add eslint
52
                  ];
7fa943eb   梁灏   init
53
54
55
56
57
58
59
60
61
              },
              mainClasses () {
                  return `${prefixCls}-main`;
              },
              dotClasses () {
                  return `${prefixCls}-dot`;
              },
              textClasses () {
                  return `${prefixCls}-text`;
297648f1   梁灏   fixed #1063
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
              },
              fullscreenVisible () {
                  if (this.fullscreen) {
                      return this.visible;
                  } else {
                      return true;
                  }
              }
          },
          watch: {
              visible (val) {
                  if (val) {
                      this.addScrollEffect();
                  } else {
                      this.removeScrollEffect();
                  }
7fa943eb   梁灏   init
78
79
              }
          },
2d43f26b   梁灏   support Spin
80
81
          mounted () {
              this.showText = this.$slots.default !== undefined;
7fa943eb   梁灏   init
82
          }
b0893113   jingsam   :art: add eslint
83
84
      };
  </script>