我想在现有子菜单中显示子菜单项。 请查看http://jsfiddle.net/nw9tU/216/
在Menu2中,提取子菜单项,我想显示两个名为Savings Acc的子菜单项,鼠标悬停时的当前Acc" Withdraw"子菜单项。 任何的意见都将会有帮助。
以下是示例代码:
var pSubMenu2 = new DropDownMenu({});
var pSubMenu3 = new DropDownMenu({});
pSubMenu2.addChild(new MenuItem({
label: "Credit"
}));
pSubMenu2.addChild(new MenuItem({
label: "Withdraw"
}));
pSubMenu2.addChild(new PopupMenuBarItem({
label: "Retail",
popup: pSubMenu3
}));
pSubMenu3.addChild(new MenuItem({
label: "Savings Acc"
}));
我可以在Withdraw子菜单的鼠标上显示一个子菜单项,但在下拉菜单中,它们是添加子菜单项时看到的间隙。如何解决它以及如何向子菜单显示多个子菜单项。感谢。
答案 0 :(得分:2)
我已更新你的小提琴link
基本上你必须创建新菜单并将其作为一个弹出菜单项附加在提取菜单项上,如下所述
`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
}) );`