Blame view

src/components/icon/icon.vue 713 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
15
16
17
          },
          computed: {
              classes () {
                  return `${prefixCls} ${prefixCls}-${this.type}`
              },
              styles () {
b79b53ea   梁灏   Icon add color prop
18
19
                  let style = {};
  
7fa943eb   梁灏   init
20
                  if (!!this.size) {
b79b53ea   梁灏   Icon add color prop
21
22
23
24
25
                      style['font-size'] = `${this.size}px`;
                  }
  
                  if (!!this.color) {
                      style.color = this.color;
7fa943eb   梁灏   init
26
                  }
b79b53ea   梁灏   Icon add color prop
27
28
  
                  return style;
7fa943eb   梁灏   init
29
30
31
32
              }
          }
      }
  </script>