feat(projects): 新增自定义svg图标动态渲染

This commit is contained in:
Soybean
2022-03-12 21:22:01 +08:00
parent f5a043b11a
commit f83c7b59b8
8 changed files with 17 additions and 60 deletions

View File

@ -1,21 +0,0 @@
import Icons from 'unplugin-icons/vite'; // iconify图标
import IconsResolver from 'unplugin-icons/resolver';
import Components from 'unplugin-vue-components/vite'; // 从指定目录自动导入组件
import { FileSystemIconLoader } from 'unplugin-icons/loaders';
export default (srcPath: string) => {
return [
Icons({
compiler: 'vue3',
customCollections: {
custom: FileSystemIconLoader(`${srcPath}/assets/svg`),
},
scale: 1,
defaultClass: 'inline-block',
}),
Components({
dts: true,
resolvers: [IconsResolver({ customCollections: ['custom'], componentPrefix: 'icon' })],
}),
];
};