Skip to content

Commit

Permalink
fix: modify icons import
Browse files Browse the repository at this point in the history
  • Loading branch information
chansee97 committed Apr 11, 2024
1 parent d490260 commit 33c1d40
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 23 deletions.
12 changes: 7 additions & 5 deletions src/components/common/DarkModeSwitch.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<script setup lang="ts">
import { NFlex } from 'naive-ui'
import { useAppStore } from '@/store'
import { renderIcon } from '@/utils'
import IconSun from '~icons/icon-park-outline/sun-one'
import IconMoon from '~icons/icon-park-outline/moon'
import IconAuto from '~icons/icon-park-outline/laptop-computer'
const { t } = useI18n()
Expand All @@ -12,25 +14,25 @@ const options = computed(() => {
{
label: t('app.lignt'),
value: 'light',
icon: 'icon-park-outline:sun-one',
icon: IconSun,
},
{
label: t('app.dark'),
value: 'dark',
icon: 'icon-park-outline:moon',
icon: IconMoon,
},
{
label: t('app.system'),
value: 'auto',
icon: 'icon-park-outline:laptop-computer',
icon: IconAuto,
},
]
})
function renderLabel(option: any) {
return h(NFlex, { align: 'center' }, {
default: () => [
renderIcon(option.icon)(),
h(option.icon),
option.label,
],
})
Expand Down
18 changes: 15 additions & 3 deletions src/layouts/components/header/UserCenter.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<script setup lang="ts">
import { renderIcon } from '@/utils/icon'
import { useAuthStore } from '@/store'
import IconGithub from '~icons/icon-park-outline/github'
import IconUser from '~icons/icon-park-outline/user'
import IconLogout from '~icons/icon-park-outline/logout'
import IconBookOpen from '~icons/icon-park-outline/book-open'
const { t } = useI18n()
Expand All @@ -12,7 +16,7 @@ const options = computed(() => {
{
label: t('app.userCenter'),
key: 'userCenter',
icon: renderIcon('carbon:user-avatar-filled-alt'),
icon: () => h(IconUser),
},
{
type: 'divider',
Expand All @@ -21,21 +25,26 @@ const options = computed(() => {
{
label: 'Github',
key: 'guthub',
icon: renderIcon('icon-park-outline:github'),
icon: () => h(IconGithub),
},
{
label: 'Gitee',
key: 'gitee',
icon: renderIcon('simple-icons:gitee'),
},
{
label: 'Docs',
key: 'docs',
icon: () => h(IconBookOpen),
},
{
type: 'divider',
key: 'd1',
},
{
label: t('app.loginOut'),
key: 'loginOut',
icon: renderIcon('icon-park-outline:logout'),
icon: () => h(IconLogout),
},
]
})
Expand All @@ -59,6 +68,9 @@ function handleSelect(key: string | number) {
if (key === 'gitee')
window.open('https://gitee.com/chansee97/nova-admin')
if (key === 'docs')
window.open('https://nova-admin-docs.netlify.app/')
}
</script>

Expand Down
19 changes: 12 additions & 7 deletions src/layouts/components/tab/TabBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
import type { RouteLocationNormalized } from 'vue-router'
import Reload from './Reload.vue'
import DropTabs from './DropTabs.vue'
import { renderIcon } from '@/utils'
import { useAppStore, useTabStore } from '@/store'
import IconRedo from '~icons/icon-park-outline/redo'
import IconClose from '~icons/icon-park-outline/close'
import IconDelete from '~icons/icon-park-outline/delete-four'
import IconLeft from '~icons/icon-park-outline/to-left'
import IconRight from '~icons/icon-park-outline/to-right'
import IconFullwith from '~icons/icon-park-outline/fullwidth'
const tabStore = useTabStore()
const appStore = useAppStore()
Expand All @@ -21,32 +26,32 @@ const options = computed(() => {
{
label: t('common.reload'),
key: 'reload',
icon: renderIcon('icon-park-outline:redo'),
icon: () => h(IconRedo),
},
{
label: t('common.close'),
key: 'closeCurrent',
icon: renderIcon('icon-park-outline:close'),
icon: () => h(IconClose),
},
{
label: t('app.closeOther'),
key: 'closeOther',
icon: renderIcon('icon-park-outline:delete-four'),
icon: () => h(IconDelete),
},
{
label: t('app.closeLeft'),
key: 'closeLeft',
icon: renderIcon('icon-park-outline:to-left'),
icon: () => h(IconLeft),
},
{
label: t('app.closeRight'),
key: 'closeRight',
icon: renderIcon('icon-park-outline:to-right'),
icon: () => h(IconRight),
},
{
label: t('app.closeAll'),
key: 'closeAll',
icon: renderIcon('icon-park-outline:fullwidth'),
icon: () => h(IconFullwith),
},
]
})
Expand Down
7 changes: 0 additions & 7 deletions src/typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ declare namespace NaiveUI {
type ThemeColor = 'default' | 'error' | 'primary' | 'info' | 'success' | 'warning'
}

declare module '~icons/*' {
import type { FunctionalComponent, SVGAttributes } from 'vue'

const component: FunctionalComponent<SVGAttributes>
export default component
}

declare namespace Storage {
interface Session {
demoKey: string
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@/*": ["src/*"]
},
"resolveJsonModule": true,
"types": ["node", "vite/client", "naive-ui/volar"],
"types": ["node", "vite/client", "naive-ui/volar", "unplugin-icons/types/vue"],
"allowJs": true,
"strict": true,
"strictNullChecks": true,
Expand Down

0 comments on commit 33c1d40

Please sign in to comment.