简体   繁体   English

SAPUI5在视图中创建HTML内容

[英]SAPUI5 create HTML content in a view

I am really new with SAPUI5 and I am just trying to make a web interface with 2 pages. 我真的是SAPUI5的新手,我只是想制作一个包含2页的Web界面。

If you're familiar with angularjs, I would like to reproduce what we can do with the ng-view element. 如果您熟悉angularjs,我想重现我们可以使用ng-view元素进行的操作。

So, how do I integrate the html code to my view? 那么,如何将html代码集成到我的视图中?

Here is the code of my actual view: 这是我实际视图的代码:

    sap.ui.jsview("delaware_pimonitor.Dashboard", {


    getControllerName : function() {
        return "delaware_pimonitor.Dashboard";
    },


    createContent : function(oController) {
        var aControls = [];
           var oButton = new sap.ui.commons.Button({
             id : this.createId("MyButton2"),
             text : "Mubutton2"
           });
           aControls.push(oButton);


           return aControls;
    }

});

The examples on internet always show me how to create a button, but that's all... 互联网上的示例总是向我展示如何创建按钮,但是仅此而已...

It is better if you don't use HTML code in sapui5(except for just making some div and appending some controls in it).Do all view related thing in your view. 最好不要在sapui5中使用HTML代码(除了仅创建一些div并在其中添加一些控件外)。在视图中执行所有与视图相关的操作。 Make a layout in view and put all the controls under that layout and finalLy return it or append in div that you have created in index.html.As for example 在视图中进行布局,并将所有控件置于该布局下,并finalLy返回它或将其附加到在index.html中创建的div中。

sap.ui.jsview("delaware_pimonitor.Dashboard", {


getControllerName : function() {
    return "delaware_pimonitor.Dashboard";
},


    createContent : function(oController) {
        var aControls = [];
           var oButton = new sap.ui.commons.Button({
             id : this.createId("MyButton2"),
             text : "Mubutton2"
           });
           aControls.push(oButton);


           return aControls// or append to div using .placeAt("your div id");
    }
    });

ANSWER HERE 在这里回答

Here is the answer: SHELL - https://sapui5.netweaver.ondemand.com/sdk/#test-resources/sap/ui/ux3/demokit/Shell.html 下面是答案:SHELL - https://sapui5.netweaver.ondemand.com/sdk/#test-resources/sap/ui/ux3/demokit/Shell.html

This allows you to create a panel and add pages or whatever you want inside it. 这使您可以创建面板并添加页面或在其中添加任何内容。 It is basically to make a top menu with each page of the website. 基本上是在网站的每个页面上做一个顶层菜单。

The demo in the last link, don't give all the code source. 最后一个链接中的演示,不提供所有代码源。

So here is the all code, which is actually working now: http://jsbin.com/duwoqova/1/edit 所以这是所有代码,现在可以正常使用: http : //jsbin.com/duwoqova/1/edit

Thanks again 再次感谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM