mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-14 21:12:53 +00:00
feat: complet Trunk
This commit is contained in:
parent
b0de4f3497
commit
fcd0af8346
30
packages/runtime-framework/src/trunk.ts
Normal file
30
packages/runtime-framework/src/trunk.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { ComponentClass } from 'react';
|
||||
|
||||
class Trunk {
|
||||
private renderer: ComponentClass | null = null;
|
||||
private layouts: { [key: string]: ComponentClass } = {};
|
||||
|
||||
public registerRenderer(renderer: ComponentClass): any {
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
public registerLayout(componentName: string, Layout: ComponentClass): any {
|
||||
if (!componentName || !Layout) {
|
||||
return;
|
||||
}
|
||||
this.layouts[componentName] = Layout;
|
||||
}
|
||||
|
||||
public getLayout(componentName: string) {
|
||||
if (!componentName) {
|
||||
return;
|
||||
}
|
||||
return this.layouts[componentName];
|
||||
}
|
||||
|
||||
public getRenderer(): ComponentClass | null {
|
||||
return this.renderer;
|
||||
}
|
||||
}
|
||||
|
||||
export default new Trunk();
|
||||
Loading…
x
Reference in New Issue
Block a user