Blame view

src/Space/Space.js 887 Bytes
01d139c3   Imshann   feat(space): 实现组件
1
2
  import template from "./Space.html";
  import style from "antd/lib/space/style/index.css";
3a3ecabe   Imshann   init
3
  class Space {
01d139c3   Imshann   feat(space): 实现组件
4
5
      useModules = ["esNgAntd"];
  
3a3ecabe   Imshann   init
6
      props = { direction: String, size: String };
01d139c3   Imshann   feat(space): 实现组件
7
8
9
  
      state = {
          direction: this.props.direction || "horizontal",
3c86e8de   Imshann   feat(space): 优化组件
10
          size: this.props.size || 8,
01d139c3   Imshann   feat(space): 实现组件
11
12
13
14
      };
  
      template = template;
  
3a3ecabe   Imshann   init
15
      constructor() {
01d139c3   Imshann   feat(space): 实现组件
16
17
18
19
          esNgAntd.createStyle("ant-space", style);
          $element.removeAttr("ng-class");
          $element.removeAttr("ng-style");
          let childrens = $transclude();
3c86e8de   Imshann   feat(space): 优化组件
20
21
22
23
24
25
26
27
          for (let i = 0; i < childrens.length; i++) {
              const children = childrens[i];
              if (children.nodeType === 1) {
                  let item = angular
                      .element("<div>")
                      .addClass("ant-space-item")
                      .append(children);
                  $element.append(item);
01d139c3   Imshann   feat(space): 实现组件
28
29
              }
          }
3a3ecabe   Imshann   init
30
31
      }
  }