【发布时间】:2017-10-15 21:52:30
【问题描述】:
我正在尝试创建一个菜单,以便在启动时使用主窗口打开各种页面。这是我设置为在包启动时运行的 js 文件:
var win = null;
function getAppMenu()
{
var menu = new nw.Menu({type: 'menubar'});
menu.append(new nw.MenuItem({
label: 'Home',
click: function(){
win.open('index.html');
alert('asdf');
}
}));
menu.append(new nw.MenuItem({
label: 'Inventory',
click: function(){
alert('asdf');
win.open('inventory.html', {}, function(win){});
}
}));
return menu;
}
nw.Window.open('index.html', {id:'main', fullscreen:false, resizable: true, width:800, height:600, focus:true}, function(newwin){
win = newwin;
newwin.menu = getAppMenu();
});
菜单已设置,但是当我单击任一菜单项时,页面未加载。我做错了什么?
【问题讨论】:
-
请告诉为什么这被否决了,并且投票结束了。现在他们的机器人攻击了我,我生气了谁。它发生在我现在发布的最后两个问题上。
标签: nw.js