Commit 3c86e8dede66859a409d10edd401b1084cbe4fc9

Authored by Imshann
1 parent 01d139c3

feat(space): 优化组件

Showing 2 changed files with 17 additions and 21 deletions   Show diff stats
build/Space/Space.js
@@ -27,17 +27,15 @@ angular.module("esNgAntd").directive("esSpace", function (esNgAntd) { @@ -27,17 +27,15 @@ angular.module("esNgAntd").directive("esSpace", function (esNgAntd) {
27 $element.removeAttr("ng-style"); 27 $element.removeAttr("ng-style");
28 let childrens = $transclude(); 28 let childrens = $transclude();
29 29
30 - for (const key in childrens) {  
31 - if (Object.hasOwnProperty.call(childrens, key)) {  
32 - const children = childrens[key]; 30 + for (let i = 0; i < childrens.length; i++) {
  31 + const children = childrens[i];
33 32
34 - if (children.nodeType === 1) {  
35 - let item = angular  
36 - .element("<div>")  
37 - .addClass("ant-space-item")  
38 - .append(children);  
39 - $element.append(item);  
40 - } 33 + if (children.nodeType === 1) {
  34 + let item = angular
  35 + .element("<div>")
  36 + .addClass("ant-space-item")
  37 + .append(children);
  38 + $element.append(item);
41 } 39 }
42 } 40 }
43 }, 41 },
src/Space/Space.js
@@ -7,7 +7,7 @@ class Space { @@ -7,7 +7,7 @@ class Space {
7 7
8 state = { 8 state = {
9 direction: this.props.direction || "horizontal", 9 direction: this.props.direction || "horizontal",
10 - size: this.props.size || 8 10 + size: this.props.size || 8,
11 }; 11 };
12 12
13 template = template; 13 template = template;
@@ -17,16 +17,14 @@ class Space { @@ -17,16 +17,14 @@ class Space {
17 $element.removeAttr("ng-class"); 17 $element.removeAttr("ng-class");
18 $element.removeAttr("ng-style"); 18 $element.removeAttr("ng-style");
19 let childrens = $transclude(); 19 let childrens = $transclude();
20 - for (const key in childrens) {  
21 - if (Object.hasOwnProperty.call(childrens, key)) {  
22 - const children = childrens[key];  
23 - if (children.nodeType === 1) {  
24 - let item = angular  
25 - .element("<div>")  
26 - .addClass("ant-space-item")  
27 - .append(children);  
28 - $element.append(item);  
29 - } 20 + for (let i = 0; i < childrens.length; i++) {
  21 + const children = childrens[i];
  22 + if (children.nodeType === 1) {
  23 + let item = angular
  24 + .element("<div>")
  25 + .addClass("ant-space-item")
  26 + .append(children);
  27 + $element.append(item);
30 } 28 }
31 } 29 }
32 } 30 }