feat: 配合unplugin-icons集成iconify图标解决方案

This commit is contained in:
张传龙
2022-04-08 17:21:48 +08:00
parent 7b90d7f8de
commit ec55f33655
8 changed files with 122 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
<template>
<div class="logo">
<n-icon size="36" color="#316c72">
<LastfmSquare />
<IconLogo />
</n-icon>
<router-link to="/">
<n-gradient-text type="primary">{{ title }}</n-gradient-text>
@@ -10,7 +10,7 @@
</template>
<script setup>
import { LastfmSquare } from '@vicons/fa'
import { IconLogo } from '@/components/AppIcons'
const title = import.meta.env.VITE_APP_TITLE
</script>

View File

@@ -16,7 +16,7 @@ import { computed, h } from 'vue'
import { usePermissionStore } from '@/store/modules/permission'
import { NIcon } from 'naive-ui'
import { ListAlt, CircleRegular } from '@vicons/fa'
import { IconCircle, IconMenu } from '@/components/AppIcons'
import { isExternal } from '@/utils/is'
@@ -68,10 +68,10 @@ function generateOptions(routes, basePath) {
path: resolvePath(basePath, route.path),
}
if (route.children && route.children.length) {
curOption.icon = renderIcon(route.meta?.icon || ListAlt, { size: 16 })
curOption.icon = renderIcon(route.meta?.icon || IconMenu, { size: 16 })
curOption.children = generateOptions(route.children, resolvePath(basePath, route.path))
} else {
curOption.icon = (route.meta?.icon && renderIcon(route.meta?.icon)) || renderIcon(CircleRegular, { size: 8 })
curOption.icon = (route.meta?.icon && renderIcon(route.meta?.icon)) || renderIcon(IconCircle, { size: 8 })
}
options.push(curOption)
}