Skip to content

Icon 图标

对 Font Awesome 图标的轻量封装,用于在页面中展示各种状态、操作图标。

基础用法

通过 icon 指定图标名,使用 typecolor 控制颜色。

基础用法
Icon 组件的基础用法
<script setup lang="ts">
import Icon from '@/components/Icon/Icon.vue'
</script>

<template>
  <Icon icon="thumbs-up" type="primary" />
  <Icon icon="check" type="success" />
  <Icon icon="triangle-exclamation" type="warning" />
  <Icon icon="xmark" type="danger" />
</template>

API

Icon Attributes

Icon 组件大部分属性与 @fortawesome/vue-fontawesome 一致,这里列出 Pure-Element 扩展的部分:

参数说明类型默认值
type预设类型,用于统一主题色'primary' | 'success' | 'warning' | 'danger' | 'info'-
color自定义颜色string-
icon图标名称或定义object | string | string[] | IconDefinition-

其他属性(如 sizespin 等)请参考 Font Awesome 官方文档。