Blame view

src/Icon/Icon.js 631 Bytes
3a3ecabe   Imshann   init
1
2
3
4
  import  * as iconsSvg from "@ant-design/icons-svg";
  import { renderIconDefinitionToSVGElement } from "@ant-design/icons-svg/es/helpers";
  
  class Icon {
dd962f77   Imshann   优化
5
6
7
8
      useModules = ["$compile"];
  
      template = `<span class="anticon"></span>`
  
3a3ecabe   Imshann   init
9
10
11
12
13
      props = {
          type: String,
      };
  
      constructor() {
dd962f77   Imshann   优化
14
15
16
          let template = renderIconDefinitionToSVGElement(
              iconsSvg[$scope.type],
              {
3a3ecabe   Imshann   init
17
18
19
20
21
                  extraSVGAttrs: {
                      width: "1em",
                      height: "1em",
                      fill: "currentColor",
                  },
dd962f77   Imshann   优化
22
23
24
              }
          )
          $element.append(template);
3a3ecabe   Imshann   init
25
26
      }
  }