From 33c1d4087da9e40ec062153784d795491bf7d9d4 Mon Sep 17 00:00:00 2001 From: chansee97 Date: Thu, 11 Apr 2024 21:56:24 +0800 Subject: [PATCH] fix: modify icons import --- src/components/common/DarkModeSwitch.vue | 12 +++++++----- src/layouts/components/header/UserCenter.vue | 18 +++++++++++++++--- src/layouts/components/tab/TabBar.vue | 19 ++++++++++++------- src/typings/global.d.ts | 7 ------- tsconfig.json | 2 +- 5 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/components/common/DarkModeSwitch.vue b/src/components/common/DarkModeSwitch.vue index 276555c4..acd3ff6f 100644 --- a/src/components/common/DarkModeSwitch.vue +++ b/src/components/common/DarkModeSwitch.vue @@ -1,7 +1,9 @@ diff --git a/src/layouts/components/tab/TabBar.vue b/src/layouts/components/tab/TabBar.vue index 76e537f8..4753fe77 100644 --- a/src/layouts/components/tab/TabBar.vue +++ b/src/layouts/components/tab/TabBar.vue @@ -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() @@ -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), }, ] }) diff --git a/src/typings/global.d.ts b/src/typings/global.d.ts index 13153063..96982e2d 100644 --- a/src/typings/global.d.ts +++ b/src/typings/global.d.ts @@ -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 - export default component -} - declare namespace Storage { interface Session { demoKey: string diff --git a/tsconfig.json b/tsconfig.json index 3e280eb6..9725c26f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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,