轻量级前端框架助力开发者提升项目效率与性能
477
2022-09-10
Demo:Menu Bar
效果图
script>
<script>
//Function to handle the select event of the items
var handleSelect = function(oEvent){
alert(oEvent.getParameter("item").getId());
};
// Create a menu bar instance
var oMenuBar = new sap.ui.commons.MenuBar("menuBar");
// Create two main menu items for the menubar - for which you define subitems lateron
var oMbProjct = new sap.ui.commons.MenuItem("menuBar_Project",{text:"Project"});
oMenuBar.addItem(oMbProjct);
var oMbRole = new sap.ui.commons.MenuItem("menuBar_Roles",{text:"Roles"});
oMenuBar.addItem(oMbRole);
oMbRole.attachSelect(handleSelect);
// Create a menu instance for the "Project" menu
var oMsubProj = new sap.ui.commons.Menu("menu1");
oMbProjct.setSubmenu(oMsubProj);
// Create and add five sub-items for the "Project" menu
var oMiShow = new sap.ui.commons.MenuItem("item1_Show",{text:"Show"});
oMsubProj.addItem(oMiShow);
var oMiPropty = new sap.ui.commons.MenuItem("item_Property",{text:"Properties"});
oMsubProj.addItem(oMiPropty);
oMiPropty.attachSelect(handleSelect);
//Create a sub menu for item "Show"
var oMsubShow = new sap.ui.commons.Menu("menu2");
oMiShow.setSubmenu(oMsubShow);
var oMiTask = new sap.ui.commons.MenuItem("item_Task",{text:"Tasks"});
oMsubShow.addItem(oMiTask);
oMiTask.attachSelect(handleSelect);
var oMiResp = new sap.ui.commons.MenuItem("item_Pesp",{text:"Responsibilities"});
oMsubShow.addItem(oMiResp);
oMiResp.attachSelect(handleSelect);
// Attach the menubar to the page
oMenuBar.placeAt("content");
script>
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~