Blame view

src/components/icon/icon.vue 1.21 KB
7fa943eb   梁灏   init
1
  <template>
9272508e   Aresn   Update icon.vue
2
      <i :class="classes" :style="styles" @click="handleClick"></i>
7fa943eb   梁灏   init
3
4
5
6
7
  </template>
  <script>
      const prefixCls = 'ivu-icon';
  
      export default {
06322514   梁灏   support Radio
8
          name: 'Icon',
7fa943eb   梁灏   init
9
          props: {
77376451   梁灏   fixed #3568
10
11
12
13
              type: {
                  type: String,
                  default: ''
              },
b79b53ea   梁灏   Icon add color prop
14
              size: [Number, String],
77376451   梁灏   fixed #3568
15
16
17
18
19
              color: String,
              custom: {
                  type: String,
                  default: ''
              }
7fa943eb   梁灏   init
20
21
22
          },
          computed: {
              classes () {
77376451   梁灏   fixed #3568
23
24
25
26
27
28
29
                  return [
                      `${prefixCls}`,
                      {
                          [`${prefixCls}-${this.type}`]: this.type !== '',
                          [`${this.custom}`]: this.custom !== '',
                      }
                  ];
7fa943eb   梁灏   init
30
31
              },
              styles () {
b79b53ea   梁灏   Icon add color prop
32
33
                  let style = {};
  
b0893113   jingsam   :art: add eslint
34
                  if (this.size) {
b79b53ea   梁灏   Icon add color prop
35
36
37
                      style['font-size'] = `${this.size}px`;
                  }
  
b0893113   jingsam   :art: add eslint
38
                  if (this.color) {
b79b53ea   梁灏   Icon add color prop
39
                      style.color = this.color;
7fa943eb   梁灏   init
40
                  }
b79b53ea   梁灏   Icon add color prop
41
42
  
                  return style;
7fa943eb   梁灏   init
43
              }
9272508e   Aresn   Update icon.vue
44
45
46
47
48
          },
          methods: {
              handleClick (event) {
                  this.$emit('click', event);
              }
7fa943eb   梁灏   init
49
          }
b0893113   jingsam   :art: add eslint
50
51
      };
  </script>