0
点赞
收藏
分享

微信扫一扫

element-plus Icon 图标全局使用方法,可供菜单图标使用

西街小学的王 2022-02-19 阅读 145

封装组件

<template>
  <el-icon :size="size" :color="color">
    <component :is="name"></component>
  </el-icon>
</template>

<script>
import { ref, defineComponent } from "vue";
import * as Icons from "@element-plus/icons";

export default defineComponent({
  components: Icons,
  name: "ElIcons",
  props: {
    name: {
      type: String,
      required: true,
    },
    size: {
      type: String,
      default: "",
    },
    color: {
      type: String,
      default: "",
    },
  },
});
</script>

调用方法

<el-icons :name="item.meta.icon"  />
举报

相关推荐

0 条评论