vue electron min width

To set a minimum width for an Electron application using Vue, follow these steps:

  1. In the public folder of the Vue project, locate the index.html file.
  2. Inside the <head> tag, add the following meta tag:
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
  1. In the Electron main process file (usually named main.js), set the minWidth 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)
  1. Save the changes and restart the Electron application for the minimum width to take effect.