mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 22:58:15 +00:00
fix: 初始就create 所有documentInstance, 否则路由跳转有问题
This commit is contained in:
parent
5ae08f5235
commit
fdd6978319
@ -69,8 +69,14 @@ export class Project {
|
|||||||
if (autoOpen) {
|
if (autoOpen) {
|
||||||
if (autoOpen === true) {
|
if (autoOpen === true) {
|
||||||
// auto open first document or open a blank page
|
// auto open first document or open a blank page
|
||||||
this.open(this.data.componentsTree[0]);
|
// this.open(this.data.componentsTree[0]);
|
||||||
// this.data.componentsTree.map((data) => this.createDocument(data))[0].open();
|
const documentInstances = this.data.componentsTree.map((data) => this.createDocument(data));
|
||||||
|
// TODO: 暂时先读 config tabBar 里的值,后面看整个 layout 结构是否能作为引擎规范
|
||||||
|
if (this.config?.layout?.props?.tabBar?.items?.length > 1) {
|
||||||
|
documentInstances.find((i) => i.fileName === this.config.layout.props.tabBar.items[0].pagePath)?.open();
|
||||||
|
} else {
|
||||||
|
documentInstances[0].open();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// auto open should be string of fileName
|
// auto open should be string of fileName
|
||||||
this.open(autoOpen);
|
this.open(autoOpen);
|
||||||
|
|||||||
@ -160,7 +160,6 @@ const router = {
|
|||||||
if (typeof component === 'function') {
|
if (typeof component === 'function') {
|
||||||
component = component(current.$.params, router.history.location);
|
component = component(current.$.params, router.history.location);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (component instanceof Promise) {
|
if (component instanceof Promise) {
|
||||||
// Lazy loading component by import('./Foo')
|
// Lazy loading component by import('./Foo')
|
||||||
return component.then((component) => {
|
return component.then((component) => {
|
||||||
|
|||||||
@ -43,7 +43,6 @@ export default class SimulatorRendererView extends Component<{ rendererContainer
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { rendererContainer } = this.props;
|
const { rendererContainer } = this.props;
|
||||||
this.unlisten = rendererContainer.onLayoutChange(() => {
|
this.unlisten = rendererContainer.onLayoutChange(() => {
|
||||||
debugger;
|
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -80,7 +79,6 @@ export const Routes = (props: {
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
const { component } = useRouter(routes);
|
const { component } = useRouter(routes);
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
@ -170,7 +168,6 @@ class Renderer extends Component<{
|
|||||||
const { container } = documentInstance;
|
const { container } = documentInstance;
|
||||||
const { designMode, device } = container;
|
const { designMode, device } = container;
|
||||||
const { rendererContainer: renderer } = this.props;
|
const { rendererContainer: renderer } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RaxEngine
|
<RaxEngine
|
||||||
schema={documentInstance.schema}
|
schema={documentInstance.schema}
|
||||||
|
|||||||
@ -110,7 +110,6 @@ export class DocumentInstance {
|
|||||||
this.dispose = host.autorun(() => {
|
this.dispose = host.autorun(() => {
|
||||||
// sync schema
|
// sync schema
|
||||||
this._schema = document.export(1);
|
this._schema = document.export(1);
|
||||||
|
|
||||||
this.emitter.emit('rerender');
|
this.emitter.emit('rerender');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -274,6 +273,7 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
|||||||
}
|
}
|
||||||
return inst;
|
return inst;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.emitter.emit('layoutChange');
|
this.emitter.emit('layoutChange');
|
||||||
const path = host.project.currentDocument ? documentInstanceMap.get(host.project.currentDocument.id)!.path : '/';
|
const path = host.project.currentDocument ? documentInstanceMap.get(host.project.currentDocument.id)!.path : '/';
|
||||||
if (firstRun) {
|
if (firstRun) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user