feat: create plugin

This commit is contained in:
lv
2022-06-22 08:31:30 +08:00
parent 94d9618633
commit 1caf9535b9
3 changed files with 21 additions and 0 deletions

0
packages/dooringx-cli/bin/www Normal file → Executable file
View File

View File

@@ -7,6 +7,20 @@ import { specialCoList } from './special';
import deepCopys from 'deepcopy';
import { FunctionDataMap } from '../functionCenter/config';
import UserConfig from '../../config';
import { IPluginConfig } from './types';
import { ComponentItemFactory } from '../components/abstract';
// 创建插件
export const createPlugin = (config: IPluginConfig) => {
return new ComponentItemFactory(
config.key,
config.name,
{},
config.attr,
config.render,
config.attr.resize
);
};
export function deepCopy<T = any>(obj: T): T {
return deepCopys(obj);

View File

@@ -0,0 +1,7 @@
export interface IPluginConfig {
key: string;
name: string;
attr: any;
render: (props: any) => JSX.Element;
resize?: boolean;
}