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

electron-builder踩坑系列---禁止用户调整窗口大小 #18

Open
hunter-ji opened this issue Oct 8, 2020 · 0 comments
Open

electron-builder踩坑系列---禁止用户调整窗口大小 #18

hunter-ji opened this issue Oct 8, 2020 · 0 comments
Labels
Electron electron

Comments

@hunter-ji
Copy link
Owner

简述

当想为程序设定一个固定的窗口大小时候,需要限制用户对程序窗口的大小进行拖动调整。但是使用官方的设定时候,在mac平台上可以禁用调整,当在windows平台上时候却依然可以。所以为了兼容两者,可以选择使用无边框来实现。

官方文档

  • resizable Boolean (optional) - Whether window is resizable. 默认值为 true

实现

mac

win = new BrowserWindow({
  width: 800,
  height: 600,
  resizable: false
});

windows

  • 为了兼容,可选择都加上无边框
win = new BrowserWindow({
  width: 800,
  height: 600,
  frame: false,
  resizable: false
});

参考文档

@hunter-ji hunter-ji added the Electron electron label Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Electron electron
Projects
None yet
Development

No branches or pull requests

1 participant