Blame view

src/components/icon/icon.vue 877 Bytes
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
10
          props: {
              type: String,
b79b53ea   梁灏   Icon add color prop
11
12
              size: [Number, String],
              color: String
7fa943eb   梁灏   init
13
14
15
          },
          computed: {
              classes () {
b0893113   jingsam   :art: add eslint
16
                  return `${prefixCls} ${prefixCls}-${this.type}`;
7fa943eb   梁灏   init
17
18
              },
              styles () {
b79b53ea   梁灏   Icon add color prop
19
20
                  let style = {};
  
b0893113   jingsam   :art: add eslint
21
                  if (this.size) {
b79b53ea   梁灏   Icon add color prop
22
23
24
                      style['font-size'] = `${this.size}px`;
                  }
  
b0893113   jingsam   :art: add eslint
25
                  if (this.color) {
b79b53ea   梁灏   Icon add color prop
26
                      style.color = this.color;
7fa943eb   梁灏   init
27
                  }
b79b53ea   梁灏   Icon add color prop
28
29
  
                  return style;
7fa943eb   梁灏   init
30
              }
9272508e   Aresn   Update icon.vue
31
32
33
34
35
          },
          methods: {
              handleClick (event) {
                  this.$emit('click', event);
              }
7fa943eb   梁灏   init
36
          }
b0893113   jingsam   :art: add eslint
37
38
      };
  </script>