Blame view

src/Spin/Spin.js 783 Bytes
3a3ecabe   Imshann   init
1
2
3
  import template from "./Spin.html";
  
  class Spin {
3a3ecabe   Imshann   init
4
5
6
7
8
9
  
      state = {
          className: [],
          hasChildren: false,
      };
  
033b7802   Imshann   升级spin组件
10
      constructor($element, $attrs, $controllers, $transclude) {
3a3ecabe   Imshann   init
11
          this.state.className = ["ant-spin", "ant-spin-spinning"];
033b7802   Imshann   升级spin组件
12
13
14
15
16
17
18
  
          if ($transclude()) {
              let len = $transclude().lenght;
              if (len > 0) {
                  this.state.hasChildren = true;
              }
          }
3a3ecabe   Imshann   init
19
20
21
22
23
24
25
26
27
  
          if (this.size === "small") {
              this.state.className.splice(1, 0, "ant-spin-sm");
          }
  
          if (this.size === "large") {
              this.state.className.splice(1, 0, "ant-spin-lg");
          }
      }
033b7802   Imshann   升级spin组件
28
29
30
31
32
33
34
35
36
  
      render() {
          return template;
      }
  }
  
  Spin.propTypes = {
      size: PropTypes.string,
      spinning: PropTypes.boolean,
3a3ecabe   Imshann   init
37
  }