如何在SAPUI5中重新加载组件?

如何在SAPUI5中重新加载组件?,sapui5,Sapui5,我有一个SAPUI5应用程序,它使用sap.ui.core.ComponentContainer在自身内部加载其他应用程序。类似于fiori launchpad的东西。但令人惊讶的是,当我从页面中删除组件容器并尝试稍后重新加载它时,它将被添加到HTML页面中,但不会显示 var oPage = this.getView().byId("page"); oPage.removeAllContent(); if(!this._aComps[sObjectId]){ t

我有一个SAPUI5应用程序,它使用
sap.ui.core.ComponentContainer
在自身内部加载其他应用程序。类似于fiori launchpad的东西。但令人惊讶的是,当我从页面中删除组件容器并尝试稍后重新加载它时,它将被添加到HTML页面中,但不会显示

var oPage = this.getView().byId("page");
    oPage.removeAllContent();
    if(!this._aComps[sObjectId]){
        this._aComps[sObjectId] = new sap.ui.core.ComponentContainer({ name: sObjectName});
    }
    oPage.addContent(this._aComps[sObjectId]);
你知道它只在初始化时显示的原因是什么吗

虽然此代码始终有效:

var oPage = this.getView().byId("page");
    oPage.removeContent();
    oPage.addContent(new sap.ui.core.ComponentContainer({ name: sObjectName}));

经过大量调查,我似乎在SAPUI5中发现了一个bug

删除
ComponentContainer
并再次添加后,SAPUI5会从组件容器元素中删除
style=“height:100%;”

再次添加后,似乎不会将高度返回到默认值。我还测试了
setVisible
函数,问题也存在

因此,我们必须做的是:

var oPage = this.getView().byId("page");
    oPage.removeAllContent();
    if(!this._aComps[sObjectId]){
        this._aComps[sObjectId] = new sap.ui.core.ComponentContainer({ name: sObjectName});
    }
    oPage.addContent(this._aComps[sObjectId]);
    this._aComps[sObjectId].setHeight("100%"); // Set the height to 100% again!

注意:它删除高度:100%不仅适用于组件容器本身,也适用于其他一些父元素。请把注意力集中在这幅画上!虽然这个解决方案适合我,但在其他用例中可能需要设置其他元素的高度

好发现!如果它是一个bug,你能在openUI5 github上记录它,这样就可以解决它了吗?