Blame view

pc-master/src/components/Icon/SvgIcon.vue 483 Bytes
3f535f30   杨鑫   '初始'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  <template>
    <svg class="svg-icon" aria-hidden="true">
      <use :xlink:href="iconName"></use>
    </svg>
  </template>
  
  <script>
  export default {
    name: 'icon-svg',
  
    props: {
  
      iconClass: {
      type: String,
      required: true
      }
    },
    computed: {
      iconName () {
      return `#icon-${this.iconClass}`
      }
    }
  }
  
  </script>
  
  <style scoped>
    .svg-icon {
      width: 1em;
      height: 1em;
      vertical-align: -0.15em;
      fill: currentColor;
      overflow: hidden;
    }
  </style>