Blame view

src/Space/Space.js 982 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
10
11
12
13
14
  
      state = {
          direction: this.props.direction || "horizontal",
          size: this.props.size || 8
      };
  
      template = template;
  
3a3ecabe   Imshann   init
15
      constructor() {
01d139c3   Imshann   feat(space): 实现组件
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
          esNgAntd.createStyle("ant-space", style);
          $element.removeAttr("ng-class");
          $element.removeAttr("ng-style");
          let childrens = $transclude();
          for (const key in childrens) {
              if (Object.hasOwnProperty.call(childrens, key)) {
                  const children = childrens[key];
                  if (children.nodeType === 1) {
                      let item = angular
                          .element("<div>")
                          .addClass("ant-space-item")
                          .append(children);
                      $element.append(item);
                  }
              }
          }
3a3ecabe   Imshann   init
32
33
      }
  }