2017-04-26 60 views

回答

0

使用點擊事件裏面BrowserWindowloadUrl方法。

如:

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

    const template = [ 
    { 
     label: 'Custom', 
     submenu: [ 
     { 
      label: 'navigate', 
      click() 
      { 
      win.loadURL('https://electron.atom.io'); 

      } 
     } 

     ] 
    } 
    ] 

    const menu = Menu.buildFromTemplate(template) 
    Menu.setApplicationMenu(menu) 
    // and load the index.html of the app. 
    win.loadURL(url.format({ 
    pathname: path.join(__dirname, 'index.html'), 
    protocol: 'file:', 
    slashes: true 
    })) 
+0

感謝rawel它幫助了答覆。 – ajay