vue electron min width
To set a minimum width for an Electron application using Vue, follow these steps:
- In the
public
folder of the Vue project, locate theindex.html
file. - Inside the
<head>
tag, add the following meta tag:
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
- In the Electron
main
process file (usually namedmain.js
), set theminWidth
property for the main window:
const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
minWidth: 600, // Set the minimum width here
minHeight: 400,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
}
app.whenReady().then(createWindow)
- Save the changes and restart the Electron application for the minimum width to take effect.