feat(projects): 添加SvgIcon,配置vite plugin

This commit is contained in:
Liushengqun
2022-02-25 17:56:00 +08:00
parent 50c8b9daa1
commit 378d55ac0e
29 changed files with 1121 additions and 3 deletions

View File

@ -16,6 +16,15 @@
<web-site-link label="iconify地址" link="https://icones.js.org/" class="mt-10px" />
</template>
</n-card>
<n-card title="SvgIcon 示例" class="mt-10px shadow-sm rounded-16px">
<div class="grid grid-cols-10">
<template v-for="item in svgIcons" :key="item">
<div class="mt-5px flex-x-center">
<svg-icon :name="item" />
</div>
</template>
</div>
</n-card>
</div>
</template>
@ -24,6 +33,7 @@ import { ref } from 'vue';
import { Icon } from '@iconify/vue';
import { IconSelect, WebSiteLink } from '@/components';
import { icons } from './icons';
import { svgIcons } from './svg-icons';
const selectVal = ref('');
</script>

View File

@ -0,0 +1,4 @@
const importSvgIcons = import.meta.glob('../../../assets/svg/**/*.svg');
export const svgIcons = Object.keys(importSvgIcons).map(k => {
return k.split('/svg/')[1].replaceAll('/', '-').replace('.svg', '');
});