mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 17:48:13 +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 === true) {
|
||||
// auto open first document or open a blank page
|
||||
this.open(this.data.componentsTree[0]);
|
||||
// this.data.componentsTree.map((data) => this.createDocument(data))[0].open();
|
||||
// this.open(this.data.componentsTree[0]);
|
||||
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 {
|
||||
// auto open should be string of fileName
|
||||
this.open(autoOpen);
|
||||
|
||||
@ -160,7 +160,6 @@ const router = {
|
||||
if (typeof component === 'function') {
|
||||
component = component(current.$.params, router.history.location);
|
||||
}
|
||||
|
||||
if (component instanceof Promise) {
|
||||
// Lazy loading component by import('./Foo')
|
||||
return component.then((component) => {
|
||||
|
||||
@ -43,7 +43,6 @@ export default class SimulatorRendererView extends Component<{ rendererContainer
|
||||
componentDidMount() {
|
||||
const { rendererContainer } = this.props;
|
||||
this.unlisten = rendererContainer.onLayoutChange(() => {
|
||||
debugger;
|
||||
this.forceUpdate();
|
||||
});
|
||||
}
|
||||
@ -80,7 +79,6 @@ export const Routes = (props: {
|
||||
};
|
||||
})
|
||||
};
|
||||
|
||||
const { component } = useRouter(routes);
|
||||
return component;
|
||||
}
|
||||
@ -170,7 +168,6 @@ class Renderer extends Component<{
|
||||
const { container } = documentInstance;
|
||||
const { designMode, device } = container;
|
||||
const { rendererContainer: renderer } = this.props;
|
||||
|
||||
return (
|
||||
<RaxEngine
|
||||
schema={documentInstance.schema}
|
||||
|
||||
@ -110,7 +110,6 @@ export class DocumentInstance {
|
||||
this.dispose = host.autorun(() => {
|
||||
// sync schema
|
||||
this._schema = document.export(1);
|
||||
|
||||
this.emitter.emit('rerender');
|
||||
});
|
||||
}
|
||||
@ -274,6 +273,7 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
}
|
||||
return inst;
|
||||
});
|
||||
|
||||
this.emitter.emit('layoutChange');
|
||||
const path = host.project.currentDocument ? documentInstanceMap.get(host.project.currentDocument.id)!.path : '/';
|
||||
if (firstRun) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user