<template>
  <i class="zui-icon" :class="classRender" :style="styleRender">
    <div v-if="info" class="zui-info">{{ info }}</div>
  </i>
</template>

<script>
export default {
  name: 'Icon',
  props: {
    name: {
      type: String,
      default: '',
    },
    fontFamily: {
      type: String,
      default: 'iconfont',
    },
    classPrefix: {
      type: String,
      default: 'icon-'
    },
    size: {
      type: String,
      default: 'inherit'
    },
    color: {
      type: String,
      default: 'inherit'
    },
    info: [Number, String]
  },
  computed: {
    classRender: function() {
      var fontFamily = this.fontFamily || '';
      var iconClass = this.classPrefix + this.name;
      return [fontFamily, iconClass]
    },
    styleRender: function() {
      return {
        fontSize: this.size,
        color: this.color
      }
    },
  }
}
</script>

<style>
@import "./index.css";
</style>