在SAPUI5项目中使用sap.ui.ux3.Shell时,无法在iphone上滚动

Unable to Scroll on iphone while using sap.ui.ux3.Shell for SAPUI5 Project

本文关键字:滚动 iphone Shell ux3 项目 SAPUI5 sap ui      更新时间:2023-12-28

我使用的是sap.ui.ux3.Shell,并在Shell画布中填充了大量数据,我可以使用chrome浏览器在桌面(笔记本电脑)上完美滚动,但由于某些原因,滚动在Iphone 6(plus)上不起作用。滚动条在安卓手机上确实有效,但在Iphone上不起作用。下面是我正在使用的代码。正如您在下面看到的,代码基本上只是创建shell,并使用for循环用一些测试数据填充shell。此代码位于SAPUI5项目中javascript视图的createContent方法中。

    var oShell = new sap.ui.ux3.Shell("myShell", {
         appTitle:"Promo Verification System",
            fullHeightContent : true,
            worksetItems: [new sap.ui.ux3.NavigationItem("home",{key:"sh_1",text:"Home"}),      
                           ],
        });
    for(i=0;i<1000;i++){
    oShell.addContent( new sap.m.Label({
        text : 'Admin Screenshots'
    }));
    }
      this.addContent(oShell);  

如果有帮助的话,将fullHeightContent设置为true可以在我的笔记本电脑或桌面上的浏览器中滚动。但我不知道为什么它在Iphone上不起作用。

找到了解决方案。您将需要一个滚动容器来完成此操作。只需将内容添加到Scroll容器而不是shell中,然后将滚动容器添加到shell中。我正在粘贴下面的代码。最重要的是,您需要设置滚动容器的高度,否则它将无法工作。

                var mscroll = new sap.m.ScrollContainer("mScroll", {
                   height: '600px',
                   vertical: true,
                });
            var oShell = new sap.ui.ux3.Shell("myShell", {
     appTitle:"Promo Verification System",
        fullHeightContent : true,
        worksetItems: [new sap.ui.ux3.NavigationItem("home",{key:"sh_1",text:"Home"}),      
                       ],
    });
               for(i=0;i<1000;i++){
                  mscroll.addContent( new sap.m.Label({
                  text : 'Admin Screenshots'
                  }));
                 }

                        oShell.addContent(mscroll);
                        this.addContent(oShell);