perf: reduce the number of icon component instances
parent
f7a93a9bb3
commit
3571511394
|
@ -0,0 +1,9 @@
|
||||||
|
import { h } from 'vue';
|
||||||
|
|
||||||
|
import { Icon } from '@iconify/vue';
|
||||||
|
|
||||||
|
function createIcon(icon: string) {
|
||||||
|
return h(Icon, { icon });
|
||||||
|
}
|
||||||
|
|
||||||
|
export { createIcon };
|
|
@ -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,4 +1,4 @@
|
||||||
export * from './factory';
|
export * from './create-icon';
|
||||||
export * from './material';
|
export * from './material';
|
||||||
export * from './mdi';
|
export * from './mdi';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { createIcon } from './factory';
|
import { createIcon } from './create-icon';
|
||||||
|
|
||||||
export const IconDefault = createIcon('ic:round-auto-awesome');
|
export const IconDefault = createIcon('ic:round-auto-awesome');
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { createIcon } from './factory';
|
import { createIcon } from './create-icon';
|
||||||
|
|
||||||
export const MdiKeyboardEsc = createIcon('mdi:keyboard-esc');
|
export const MdiKeyboardEsc = createIcon('mdi:keyboard-esc');
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,6 @@ const slots = useSlots();
|
||||||
<slot name="tip"></slot>
|
<slot name="tip"></slot>
|
||||||
</VbenTooltip>
|
</VbenTooltip>
|
||||||
</span>
|
</span>
|
||||||
<Input v-model="inputValue" class="h-8 w-[160px]" />
|
<Input v-model="inputValue" class="h-8 w-[165px]" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -54,7 +54,7 @@ const slots = useSlots();
|
||||||
</VbenTooltip>
|
</VbenTooltip>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<NumberField v-model="inputValue" v-bind="$attrs" class="w-[160px]">
|
<NumberField v-model="inputValue" v-bind="$attrs" class="w-[165px]">
|
||||||
<NumberFieldContent>
|
<NumberFieldContent>
|
||||||
<NumberFieldDecrement />
|
<NumberFieldDecrement />
|
||||||
<NumberFieldInput />
|
<NumberFieldInput />
|
||||||
|
|
|
@ -54,7 +54,7 @@ const slots = useSlots();
|
||||||
</VbenTooltip>
|
</VbenTooltip>
|
||||||
</span>
|
</span>
|
||||||
<Select v-model="selectValue">
|
<Select v-model="selectValue">
|
||||||
<SelectTrigger class="h-8 w-[160px]">
|
<SelectTrigger class="h-8 w-[165px]">
|
||||||
<SelectValue :placeholder="placeholder" />
|
<SelectValue :placeholder="placeholder" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
|
|
@ -26,7 +26,7 @@ page:
|
||||||
embedded: embedded Page
|
embedded: embedded Page
|
||||||
external-link: External Link
|
external-link: External Link
|
||||||
fallback:
|
fallback:
|
||||||
title: Exception Page
|
title: Fallback Page
|
||||||
essentials:
|
essentials:
|
||||||
login: Login
|
login: Login
|
||||||
register: Register
|
register: Register
|
||||||
|
@ -152,7 +152,7 @@ preferences:
|
||||||
two-column-tip: Vertical Two Column Menu Mode
|
two-column-tip: Vertical Two Column Menu Mode
|
||||||
mixed-menu: Mixed Menu
|
mixed-menu: Mixed Menu
|
||||||
split-menu: Split 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: Full Content
|
||||||
full-content-tip: Display only the main content, no menus
|
full-content-tip: Display only the main content, no menus
|
||||||
weak-mode: Color Weak Mode
|
weak-mode: Color Weak Mode
|
||||||
|
|
|
@ -26,7 +26,7 @@ page:
|
||||||
embedded: 内嵌
|
embedded: 内嵌
|
||||||
external-link: 外链
|
external-link: 外链
|
||||||
fallback:
|
fallback:
|
||||||
title: 异常页面
|
title: 缺省页
|
||||||
essentials:
|
essentials:
|
||||||
login: 登陆
|
login: 登陆
|
||||||
register: 注册
|
register: 注册
|
||||||
|
@ -152,7 +152,7 @@ preferences:
|
||||||
two-column: 双列菜单
|
two-column: 双列菜单
|
||||||
two-column-tip: 垂直双列菜单模式
|
two-column-tip: 垂直双列菜单模式
|
||||||
mixed-menu: 混合菜单
|
mixed-menu: 混合菜单
|
||||||
mixed-menu-tip: 垂直菜单共存
|
mixed-menu-tip: 垂直水平菜单共存
|
||||||
split-menu: 切割菜单
|
split-menu: 切割菜单
|
||||||
full-content: 内容全屏
|
full-content: 内容全屏
|
||||||
full-content-tip: 不显示任何菜单,只显示内容主体
|
full-content-tip: 不显示任何菜单,只显示内容主体
|
||||||
|
|
Loading…
Reference in New Issue