Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nw.js 开发笔记 #66

Open
Dream4ever opened this issue May 7, 2019 · 0 comments
Open

nw.js 开发笔记 #66

Dream4ever opened this issue May 7, 2019 · 0 comments

Comments

@Dream4ever
Copy link
Owner

Dream4ever commented May 7, 2019

设置任务栏图标及标题栏左侧图标

package.json 中,添加如下配置即可:

  "window": {
    "icon": "app/img/book.png"
  }

注意,该设置与下面的“设置文件图标”互不影响,各自负责设置不同地方的图标,没有交集。

参考:

设置文件图标

用 Resource Hacker 打开 exe 文件,修改图标后保存即可。Total Commander 需要重启一下才能看到新图标,Windows 资源管理器就不用。

参考:

启动后让窗口最大化

var gui = require('nw.gui')
var win = gui.Window.get()
win.maximize()

参考:

打开新窗口并设置其尺寸

var path = require('path')
var ebookPath = path.join(process.cwd(), 'app/ebook/index.html')

var win = gui.Window.get()
var width = win.width
var height = win.height

var config = {
  'width': width,
  'height': height
}

nw.Window.open(ebookPath, config)

参考:

参考资料

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant