<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                # Electron右鍵菜單 [TOC] ## 案例 - 新建demo3.js ~~~ const { remote} = require('electron') var rigthTemplate = [ {label:'粘貼'}, {label:'復制'} ] var m = remote.Menu.buildFromTemplate(rigthTemplate) //右鍵監聽 window.addEventListener('contextmenu',function(e){ //阻止當前窗口默認事件 e.preventDefault(); //把菜單模板添加到右鍵菜單 m.popup({window:remote.getCurrentWindow()}) }) ~~~ - 打開調試模式 ~~~ win.webContents.openDevTools() ~~~ - 修改main.js ~~~ const { app, BrowserWindow } = require('electron') function createWindow () { const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true, enableRemoteModule: true // 使用remote模塊 } }) //打開調試模式 win.webContents.openDevTools() require('./menu.js') win.loadFile('renderer/demo2.html') } app.whenReady().then(createWindow) app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit() } }) app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) { createWindow() } }) ~~~ - 修改demo2.html 添加代碼 ~~~ <script src="demo3.js"></script> ~~~ - 運行 ![](https://img.kancloud.cn/1f/f5/1ff530c7d34f5c1cf2b512de73bde92b_785x593.png) ## 源碼 鏈接:https://share.weiyun.com/QrUPGAAn 密碼:gbkp3n
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看