Browse Source

perf: reduce the number of icon component instances

vben 8 months ago
parent
commit
3571511394

+ 9 - 0
packages/@core/shared/iconify/src/create-icon.ts

@@ -0,0 +1,9 @@
+import { h } from 'vue';
+
+import { Icon } from '@iconify/vue';
+
+function createIcon(icon: string) {
+  return h(Icon, { icon });
+}
+
+export { createIcon };

+ 0 - 14
packages/@core/shared/iconify/src/factory.ts

@@ -1,14 +0,0 @@
-import { defineComponent, h } from 'vue';
-
-import { Icon } from '@iconify/vue';
-
-function createIcon(name: string) {
-  return defineComponent({
-    name: `SvgIcon-${name}`,
-    setup(props, { attrs }) {
-      return () => h(Icon, { icon: name, ...props, ...attrs });
-    },
-  });
-}
-
-export { createIcon };

+ 1 - 1
packages/@core/shared/iconify/src/index.ts

@@ -1,4 +1,4 @@
-export * from './factory';
+export * from './create-icon';
 export * from './material';
 export * from './mdi';
 

+ 1 - 1
packages/@core/shared/iconify/src/material.ts

@@ -1,4 +1,4 @@
-import { createIcon } from './factory';
+import { createIcon } from './create-icon';
 
 export const IconDefault = createIcon('ic:round-auto-awesome');
 

+ 1 - 1
packages/@core/shared/iconify/src/mdi.ts

@@ -1,4 +1,4 @@
-import { createIcon } from './factory';
+import { createIcon } from './create-icon';
 
 export const MdiKeyboardEsc = createIcon('mdi:keyboard-esc');
 

+ 1 - 1
packages/business/widgets/src/preferences/blocks/input-item.vue

@@ -46,6 +46,6 @@ const slots = useSlots();
         <slot name="tip"></slot>
       </VbenTooltip>
     </span>
-    <Input v-model="inputValue" class="h-8 w-[160px]" />
+    <Input v-model="inputValue" class="h-8 w-[165px]" />
   </div>
 </template>

+ 1 - 1
packages/business/widgets/src/preferences/blocks/number-field-item.vue

@@ -54,7 +54,7 @@ const slots = useSlots();
       </VbenTooltip>
     </span>
 
-    <NumberField v-model="inputValue" v-bind="$attrs" class="w-[160px]">
+    <NumberField v-model="inputValue" v-bind="$attrs" class="w-[165px]">
       <NumberFieldContent>
         <NumberFieldDecrement />
         <NumberFieldInput />

+ 1 - 1
packages/business/widgets/src/preferences/blocks/select-item.vue

@@ -54,7 +54,7 @@ const slots = useSlots();
       </VbenTooltip>
     </span>
     <Select v-model="selectValue">
-      <SelectTrigger class="h-8 w-[160px]">
+      <SelectTrigger class="h-8 w-[165px]">
         <SelectValue :placeholder="placeholder" />
       </SelectTrigger>
       <SelectContent>

+ 2 - 2
packages/locales/src/langs/en-US.yaml

@@ -26,7 +26,7 @@ page:
       embedded: embedded Page
       external-link: External Link
     fallback:
-      title: Exception Page
+      title: Fallback Page
   essentials:
     login: Login
     register: Register
@@ -152,7 +152,7 @@ preferences:
   two-column-tip: Vertical Two Column Menu Mode
   mixed-menu: Mixed Menu
   split-menu: Split Menu
-  mixed-menu-tip: Vertical Menu Co-exists
+  mixed-menu-tip: Vertical & Horizontal Menu Co-exists
   full-content: Full Content
   full-content-tip: Display only the main content, no menus
   weak-mode: Color Weak Mode

+ 2 - 2
packages/locales/src/langs/zh-CN.yaml

@@ -26,7 +26,7 @@ page:
       embedded: 内嵌
       external-link: 外链
     fallback:
-      title: 异常页面
+      title: 缺省页
   essentials:
     login: 登陆
     register: 注册
@@ -152,7 +152,7 @@ preferences:
   two-column: 双列菜单
   two-column-tip: 垂直双列菜单模式
   mixed-menu: 混合菜单
-  mixed-menu-tip: 垂直菜单共存
+  mixed-menu-tip: 垂直水平菜单共存
   split-menu: 切割菜单
   full-content: 内容全屏
   full-content-tip: 不显示任何菜单,只显示内容主体