let win, menu;
function createWindow() {
const electronScreen = screen;
const size = electronScreen.getPrimaryDisplay().workAreaSize;
win = new BrowserWindow({
x: 0,
y: 0,
width: size.width,
height: size.height
});
// and load the index.html of the app.
win.loadURL('file://' + __dirname + '/index.html');
win.webContents.openDevTools();
win.on('closed', () => {
win = null;
});
}
function createMenu() {
const template = [{
label: 'Edit',
submenu: [
{ role: 'undo' },
{ role: 'redo' },
{ type: 'separator' },
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'pasteandmatchstyle' },
{ role: 'delete' },
{ role: 'selectall' }
]
},
{
label: 'View',
submenu: [
{ role: 'reload' },
{ role: 'forcereload' },
{ role: 'toggledevtools' },
{ type: 'separator' },
{ role: 'resetzoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
{ type: 'separator' },
{ role: 'togglefullscreen' }
]
},
{ role: 'window', submenu: [{ role: 'minimize' }, { role: 'close' }] },
{
role: 'help',
submenu: [{
label: 'Learn More',
click() {
require('electron').shell.openExternal('https://electron.atom.io');
}
}]
}
];
menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
}
try {
app.on('ready', function() {
createWindow();
createMenu();
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (win === null) {
createWindow();
}
});
} catch (e) {
throw e;
}
是否可以将 for =“file_upload”分配给输入中的 class =“file_upload”类而不是 id =“file_upload”
当我尝试它不适合上课但它适用于ID。我可以知道我是否必须使用一些不同的方法来使用类?