#Register FlowModel
#Start with a custom FlowModel
class HelloModel extends FlowModel {
render() {
return (
<div>
<h1>Hello, NocoBase!</h1>
<p>This is a simple block rendered by HelloModel.</p>
</div>
);
}
}import { Application, Plugin } from '@nocobase/client-v2';
export class PluginHelloClient extends Plugin {
async load() {
this.engine.registerModelLoaders({
HelloModel: {
// Lazy import: the module is only loaded when this model is actually used for the first time
loader: () => import('@docs/en/flow-engine/_demos/HelloModel'),
},
});
}
}
const app = new Application({
plugins: [PluginHelloClient],
})
export default app.getRootComponent();#Available FlowModel base classes
| Base Class Name | Description |
|---|---|
BlockModel | Base class for all blocks |
CollectionBlockModel | Collection block, inherits from BlockModel |
ActionModel | Base class for all actions |
#Register FlowModel
export class PluginHelloClient extends Plugin {
async load() {
this.engine.registerModelLoaders({
HelloModel: {
// Dynamic import: the model module loads only when this model is first needed
loader: () => import('./HelloModel'),
},
});
}
}
