Blame view

src/components/SvgIcon/index.vue 756 Bytes
a72ae217   王富生   第一次提交
1
  <template>
9287779a   Andy   add 官网嵌入车主平台 架构
2
    <svg :class="svgClass" aria-hidden="true" v-on="$listeners">
a72ae217   王富生   第一次提交
3
4
5
6
7
      <use :xlink:href="iconName" />
    </svg>
  </template>
  
  <script>
9287779a   Andy   add 官网嵌入车主平台 架构
8
9
10
11
12
13
14
15
16
17
    export default {
      name: 'SvgIcon',
      props: {
        iconClass: {
          type: String,
          required: true
        },
        className: {
          type: String,
          default: ''
a72ae217   王富生   第一次提交
18
19
        }
      },
9287779a   Andy   add 官网嵌入车主平台 架构
20
21
22
23
24
25
26
27
28
29
      computed: {
        iconName() {
          return `#icon-${this.iconClass}`
        },
        svgClass() {
          if (this.className) {
            return 'svg-icon ' + this.className
          } else {
            return 'svg-icon'
          }
a72ae217   王富生   第一次提交
30
31
32
        }
      }
    }
a72ae217   王富生   第一次提交
33
34
35
  </script>
  
  <style scoped>
9287779a   Andy   add 官网嵌入车主平台 架构
36
37
38
39
40
41
42
    .svg-icon {
      width: 1em;
      height: 1em;
      vertical-align: -0.15em;
      fill: currentColor;
      overflow: hidden;
    }
a72ae217   王富生   第一次提交
43
  </style>