Skip to content
On this page

SVG 图片

支持多种方式使用 svg、png 图片,主要用于多色icon场景。

基础用法

支持 name/http 链接方式引入资源。

直接使用 name,需要安装vite-plugin-svg-icons插件,使 svg 图片能够自动引入。

http 方式,svg、png 图片都可以实现自定义颜色。

<template>
    <a-space>
        <Svg name="menu-dev" color="#ba3329" width="40px" height="40px"></Svg>
        <Svg
            name="https://img.dalao.pro/file/49f8f8f58664ce4af99cc.png"
            color="#ba3329"
            width="40px"
            height="40px"
        ></Svg>
    </a-space>
</template>
<script setup lang="ts">
import { Svg } from "@easyfe/admin-component";
</script>
<template>
    <a-space>
        <Svg name="menu-dev" color="#ba3329" width="40px" height="40px"></Svg>
        <Svg
            name="https://img.dalao.pro/file/49f8f8f58664ce4af99cc.png"
            color="#ba3329"
            width="40px"
            height="40px"
        ></Svg>
    </a-space>
</template>
<script setup lang="ts">
import { Svg } from "@easyfe/admin-component";
</script>

属性

参数说明类型可选值默认值是否必填
name图片名称/链接string-
color颜色string-
width宽度string,number-
height高度string,number-

事件