Skip to content

Commit

Permalink
perf(projects): perf code
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Nov 16, 2023
1 parent c2b6aa6 commit 324cffd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
5 changes: 2 additions & 3 deletions packages/hooks/src/use-svg-icon-render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import type { Component } from 'vue';
/**
* svg icon render hook
* @param SvgIcon svg icon component
* @param defaultIcon default icon name (iconify icon name)
*/
export default function useSvgIconRender(SvgIcon: Component, defaultIcon: string) {
export default function useSvgIconRender(SvgIcon: Component) {
interface IconConfig {
/**
* iconify icon name
Expand All @@ -33,7 +32,7 @@ export default function useSvgIconRender(SvgIcon: Component, defaultIcon: string
* @param config
*/
const SvgIconVNode = (config: IconConfig) => {
const { color, fontSize, icon = defaultIcon, localIcon } = config;
const { color, fontSize, icon, localIcon } = config;

const style: IconStyle = {};

Expand Down
8 changes: 1 addition & 7 deletions src/components/common/lang-switch.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import { computed } from 'vue';
import type { TooltipPlacement } from 'ant-design-vue/es/tooltip';
import { $t } from '@/locales';
defineOptions({
Expand All @@ -20,15 +19,10 @@ interface Props {
* show tooltip
*/
showTooltip?: boolean;
/**
* tooltip placement
*/
tooltipPlacement?: TooltipPlacement;
}
const props = withDefaults(defineProps<Props>(), {
showTooltip: true,
tooltipPlacement: 'left'
showTooltip: true
});
type Emits = {
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/route/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function updateLocaleOfGlobalMenus(menus: App.Global.Menu[]) {
* @param route
*/
function getGlobalMenuByBaseRoute(route: RouteLocationNormalizedLoaded | ElegantConstRoute) {
const { SvgIconVNode } = useSvgIconRender(SvgIcon, import.meta.env.VITE_MENU_ICON);
const { SvgIconVNode } = useSvgIconRender(SvgIcon);

const { name, path } = route;
const { title, i18nKey, icon, localIcon } = route.meta ?? {};
Expand Down

0 comments on commit 324cffd

Please sign in to comment.