<template>
  <div
    :style="{
      width: width,
      height: height,
      display: 'inline-block',
      lineHeight: 1,
    }"
    class="svg-icon-btn"
  >
    <svg :style="{ width: width, height: height }">
      <use :xlink:href="prefix + name" :fill="color"></use>
    </svg>
  </div>
</template>

<script>
export default {
  name: "SvgIcon",
  props: {
    // xlink:href属性值的前缀
    prefix: {
      type: String,
      default: "#icon-",
    }, //svg矢量图的名字
    name: {
      type: String,
      require: true,
    }, //svg图标的颜色
    color: {
      type: String,
      default: "",
    }, //svg宽度
    width: {
      type: String,
      default: "16px",
    }, //svg高度
    height: {
      type: String,
      default: "16px",
    },
  },
};
</script>
