物业代码生成
This commit is contained in:
30
packages/@core/base/icons/src/create-icon.ts
Normal file
30
packages/@core/base/icons/src/create-icon.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { defineComponent, h } from 'vue';
|
||||
|
||||
import { addIcon, Icon, type IconifyIcon } from '@iconify/vue';
|
||||
|
||||
function createIconifyIcon(icon: string) {
|
||||
return defineComponent({
|
||||
name: `Icon-${icon}`,
|
||||
setup(props, { attrs }) {
|
||||
return () => h(Icon, { icon, ...props, ...attrs });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建离线图标
|
||||
* @param icon 图标名称 建议与iconify的名称保持一致
|
||||
* @param iconComponent 从@iconify/icon-xxx/xxx导入的图标
|
||||
* @returns IconComponent
|
||||
*/
|
||||
function createIconifyOfflineIcon(icon: string, iconComponent: IconifyIcon) {
|
||||
return defineComponent({
|
||||
name: `Icon-${icon}`,
|
||||
setup(props, { attrs }) {
|
||||
addIcon(icon, iconComponent);
|
||||
return () => h(Icon, { icon, ...props, ...attrs });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export { createIconifyIcon, createIconifyOfflineIcon };
|
16
packages/@core/base/icons/src/index.ts
Normal file
16
packages/@core/base/icons/src/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export * from './create-icon';
|
||||
|
||||
export * from './lucide';
|
||||
|
||||
export type { IconifyIcon as IconifyIconStructure } from '@iconify/vue';
|
||||
export {
|
||||
addCollection,
|
||||
addIcon,
|
||||
Icon as IconifyIcon,
|
||||
listIcons,
|
||||
} from '@iconify/vue';
|
||||
|
||||
/**
|
||||
* 从@iconify/vue/dist/offline'导出的组件为离线ICON 不支持在线
|
||||
* 从@iconify/vue'导出的组件为在能找到本地图标为离线 否则会在线获取(适用性更强)
|
||||
*/
|
68
packages/@core/base/icons/src/lucide.ts
Normal file
68
packages/@core/base/icons/src/lucide.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
export {
|
||||
ArrowDown,
|
||||
ArrowLeft,
|
||||
ArrowLeftToLine,
|
||||
ArrowRightLeft,
|
||||
ArrowRightToLine,
|
||||
ArrowUp,
|
||||
ArrowUpToLine,
|
||||
Bell,
|
||||
BookOpenText,
|
||||
Check,
|
||||
ChevronDown,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
ChevronsLeft,
|
||||
ChevronsRight,
|
||||
Circle,
|
||||
CircleAlert,
|
||||
CircleCheckBig,
|
||||
CircleHelp,
|
||||
CircleX,
|
||||
Copy,
|
||||
CornerDownLeft,
|
||||
Ellipsis,
|
||||
Expand,
|
||||
ExternalLink,
|
||||
Eye,
|
||||
EyeOff,
|
||||
FoldHorizontal,
|
||||
Fullscreen,
|
||||
Github,
|
||||
Grip,
|
||||
GripVertical,
|
||||
Menu as IconDefault,
|
||||
Info,
|
||||
InspectionPanel,
|
||||
Languages,
|
||||
LoaderCircle,
|
||||
LockKeyhole,
|
||||
LogOut,
|
||||
MailCheck,
|
||||
Maximize,
|
||||
ArrowRightFromLine as MdiMenuClose,
|
||||
ArrowLeftFromLine as MdiMenuOpen,
|
||||
Menu,
|
||||
Minimize,
|
||||
Minimize2,
|
||||
MoonStar,
|
||||
Palette,
|
||||
PanelLeft,
|
||||
PanelRight,
|
||||
Pin,
|
||||
PinOff,
|
||||
Plus,
|
||||
RotateCw,
|
||||
Search,
|
||||
SearchX,
|
||||
Settings,
|
||||
Shrink,
|
||||
Square,
|
||||
SquareCheckBig,
|
||||
SquareMinus,
|
||||
Sun,
|
||||
SunMoon,
|
||||
SwatchBook,
|
||||
UserRoundPen,
|
||||
X,
|
||||
} from 'lucide-vue-next';
|
Reference in New Issue
Block a user