Blame view

src/components/icon/icon.vue 712 Bytes
7fa943eb   梁灏   init
1
2
3
4
5
6
7
8
9
  <template>
      <i :class="classes" :style="styles"></i>
  </template>
  <script>
      const prefixCls = 'ivu-icon';
  
      export default {
          props: {
              type: String,
b79b53ea   梁灏   Icon add color prop
10
11
              size: [Number, String],
              color: String
7fa943eb   梁灏   init
12
13
14
          },
          computed: {
              classes () {
b0893113   jingsam   :art: add eslint
15
                  return `${prefixCls} ${prefixCls}-${this.type}`;
7fa943eb   梁灏   init
16
17
              },
              styles () {
b79b53ea   梁灏   Icon add color prop
18
19
                  let style = {};
  
b0893113   jingsam   :art: add eslint
20
                  if (this.size) {
b79b53ea   梁灏   Icon add color prop
21
22
23
                      style['font-size'] = `${this.size}px`;
                  }
  
b0893113   jingsam   :art: add eslint
24
                  if (this.color) {
b79b53ea   梁灏   Icon add color prop
25
                      style.color = this.color;
7fa943eb   梁灏   init
26
                  }
b79b53ea   梁灏   Icon add color prop
27
28
  
                  return style;
7fa943eb   梁灏   init
29
30
              }
          }
b0893113   jingsam   :art: add eslint
31
32
      };
  </script>