mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-17 11:13:50 +00:00
fix: add component
This commit is contained in:
parent
eb60d1f091
commit
995785dbc9
@ -76,7 +76,7 @@ export const Routes = (props: {
|
|||||||
routes: documentInstances.map(instance => {
|
routes: documentInstances.map(instance => {
|
||||||
return {
|
return {
|
||||||
path: instance.path,
|
path: instance.path,
|
||||||
component: (props: any) => <Renderer rendererContainer={rendererContainer} documentInstance={instance} {...props} />
|
component: (props: any) => <Renderer key={instance.id} rendererContainer={rendererContainer} documentInstance={instance} {...props} />
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
@ -128,12 +128,21 @@ class Renderer extends Component<{
|
|||||||
rendererContainer: SimulatorRendererContainer;
|
rendererContainer: SimulatorRendererContainer;
|
||||||
documentInstance: DocumentInstance;
|
documentInstance: DocumentInstance;
|
||||||
}> {
|
}> {
|
||||||
constructor(props: any) {
|
private unlisten: any;
|
||||||
super(props);
|
|
||||||
this.props.documentInstance.onReRender(() => {
|
componentDidMount() {
|
||||||
|
const { documentInstance } = this.props;
|
||||||
|
this.unlisten = documentInstance.onReRender(() => {
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
if (this.unlisten) {
|
||||||
|
this.unlisten();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { documentInstance } = this.props;
|
const { documentInstance } = this.props;
|
||||||
const { container } = documentInstance;
|
const { container } = documentInstance;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user