我想在menubar.Iam上使用dojo創建菜單欄來顯示圖標。 請找到提琴:http://jsfiddle.net/nw9tU/351/關於菜單欄顯示圖標
我試過uisng圖標屬性來顯示菜單欄上的圖標,但它沒有奏效。 下面是示例代碼:
require([
"dijit/MenuBar",
"dijit/PopupMenuBarItem",
"dijit/Menu",
"dijit/MenuItem",
"dijit/DropDownMenu",
"dijit/PopupMenuItem",
"dojo/domReady!"
],function(MenuBar, PopupMenuBarItem, Menu, MenuItem, DropDownMenu,PopupMenuItem){
var pMenuBar = new MenuBar({
});
var pSubMenu = new DropDownMenu({});
pSubMenu.addChild(new MenuItem({
label: "File item #1"
}));
pSubMenu.addChild(new MenuItem({
label: "File item #2"
}));
pMenuBar.addChild(new PopupMenuBarItem({
label : "Home",
icon: 'https://avatars1.githubusercontent.com/u/5500999?v=2&s=16',
popup: pSubMenu
}));
var withdrawMenu = new Menu({
id: "withdrawMenu"
});
withdrawMenu.addChild(new MenuItem({
id: "savings",
label: "Savings Acc"
}));
withdrawMenu.addChild(new MenuItem({
id: "checking",
label: "Checking Acc"
}));
var pSubMenu2 = new DropDownMenu({});
pSubMenu2.addChild(new MenuItem({
label: "Credit"
}));
pSubMenu2.addChild(new PopupMenuItem({
id: "withdraw",
label: "Withdraw",
popup: withdrawMenu
}));
pSubMenu2.addChild(new MenuItem({
label: "Retail"
}));
pMenuBar.addChild(new PopupMenuBarItem({
label: " || Banking",
popup: pSubMenu2
}));
pMenuBar.placeAt("menuBar");
pMenuBar.startup();
});
請建議如何顯示在菜單項上,而不是顯示標籤圖標。
Thanks @frank。但是,當我們使用dijit/ToolBar和相應的下拉按鈕時,我們是否可以實現與http://jsfiddle.net/nw9tU/351/中顯示的相同類型的下拉菜單。任何的意見都將會有幫助。謝謝。 – user3692021
檢查編輯的答案。 – frank