Iconify for Vue 2 函数:iconExists
本教程属于 Iconify for Vue 2 函数教程 的一部分。
函数 iconExists() 检查图标数据是否可用于渲染。
用法
该函数包含以下参数:
- name,string。图标名称。
该函数返回 boolean 值:如果图标可用,则返回 true;如果图标不可用,则返回 false。
示例
js
import { iconExists } from '@iconify/vue2';
const icon = 'bi:arrow-left';
console.log(`Is ${icon} available?`, iconExists(icon) ? 'yes' : 'no');