Blame view

src/components/spin/spin.vue 2.43 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
          props: {
              size: {
                  validator (value) {
cdeeeca4   梁灏   Spin support glob...
23
24
25
26
                      return oneOf(value, ['small', 'large', 'default']);
                  },
                  default () {
                      return this.$IVIEW.size === '' ? 'default' : this.$IVIEW.size;
7fa943eb   梁灏   init
27
28
29
30
31
                  }
              },
              fix: {
                  type: Boolean,
                  default: false
297648f1   梁灏   fixed #1063
32
33
34
35
              },
              fullscreen: {
                  type: Boolean,
                  default: false
7fa943eb   梁灏   init
36
37
38
39
              }
          },
          data () {
              return {
297648f1   梁灏   fixed #1063
40
41
42
                  showText: false,
                  // used for $Spin
                  visible: false
b0893113   jingsam   :art: add eslint
43
              };
7fa943eb   梁灏   init
44
45
46
47
48
49
50
51
52
          },
          computed: {
              classes () {
                  return [
                      `${prefixCls}`,
                      {
                          [`${prefixCls}-${this.size}`]: !!this.size,
                          [`${prefixCls}-fix`]: this.fix,
                          [`${prefixCls}-show-text`]: this.showText,
297648f1   梁灏   fixed #1063
53
                          [`${prefixCls}-fullscreen`]: this.fullscreen
7fa943eb   梁灏   init
54
                      }
b0893113   jingsam   :art: add eslint
55
                  ];
7fa943eb   梁灏   init
56
57
58
59
60
61
62
63
64
              },
              mainClasses () {
                  return `${prefixCls}-main`;
              },
              dotClasses () {
                  return `${prefixCls}-dot`;
              },
              textClasses () {
                  return `${prefixCls}-text`;
297648f1   梁灏   fixed #1063
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
              },
              fullscreenVisible () {
                  if (this.fullscreen) {
                      return this.visible;
                  } else {
                      return true;
                  }
              }
          },
          watch: {
              visible (val) {
                  if (val) {
                      this.addScrollEffect();
                  } else {
                      this.removeScrollEffect();
                  }
7fa943eb   梁灏   init
81
82
              }
          },
2d43f26b   梁灏   support Spin
83
84
          mounted () {
              this.showText = this.$slots.default !== undefined;
7fa943eb   梁灏   init
85
          }
b0893113   jingsam   :art: add eslint
86
87
      };
  </script>