0

我想将我的应用程序的高度和高度设置为 1400 和 800如果可能但如果屏幕小于 1400 或 800 ,应用程序打开全尺寸不是全屏 我的意思是我想要一些像这样的薄:

"window": {
    "title": "My App",
    "toolbar": false,
    "min_width": 1400,
    "min_height": 800,
    "max_width": 100%,
    "max_height": 100%,  
}

我知道我可以设置fullscreen : true

但我想要上面的东西或类似的东西fullsize : true

谢谢

4

1 回答 1

0

如果您查看文档http://docs.nwjs.io/en/latest/References/Screen/ ,这实际上非常简单

Screen.Init() //initiate the screen
var screens = Screen.screens //get all screens. you may have more then one monitor....
var work_area = screens[0]. work_area //get the work area of the screen
var max_width = work_area.width //get the max width
var max_height = work_area.height //get the max height
//check if fullscreen should be entered
if(max_height < 800 || max-wdith < 1400){
     var win = nw.Window.get();
     win.enterFullscreen()
}

如果你有屏幕宽度,你基本上会在启动时检查。如果没有,你去全屏。我想你也可以我们https://developer.chrome.com/apps/system_display来获得最大宽度和最大高度

于 2017-03-16T18:54:48.430 回答