<template>
  <div
    class="icon-class"
    :style="`font-size:${size}px`"
    @click="clickEvent"
  >
    <svg class="icon" aria-hidden="true">
      <use :xlink:href="iconName" />
    </svg>
  </div>
</template>
<script>
export default {
  props: {
    name: {
      type: String,
      required: true,
    },
    size: {
      type: Number,
      default: 12,
    },
  },
  data() {
    return {};
  },
  computed: {
    iconName() {
      return `#${this.name}`;
    },
  },
  created() {},
  mounted() {},
  methods: {
    clickEvent(e) {
      this.$emit("click", e);
    },
  },
};
</script>
<style lang="less" scoped>
.icon-class {
  display: inline-block;
  line-height: 1;
}
.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>
