乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      node-webkit,nwjs 系統(tǒng)托盤【Tray】實(shí)踐

       印度阿三17 2019-12-13

      參照自:https://www.cnblogs.com/xuanhun/p/3678943.html

      Tray包含title、tooltip、icon、menu、alticon五個(gè)屬性。

      title屬性只在mac系統(tǒng)下有效,會和icon圖標(biāo)一起顯示在狀態(tài)欄。

      tooltip是當(dāng)鼠標(biāo)移動到tray上方時(shí)顯示的提示語,在所有平臺下都有效。

      icon是tray顯示在托盤中的圖標(biāo)。

      menu是托盤中的菜單,是一個(gè) gui.Menu對象(參考:node-webkit教程6native-ui-api-之menu菜單)。

      alticon只有在mac下起作用,配置切換效果icon圖標(biāo)。

      nwjs文件如下

      其中package.nw目錄文件如下:

      img文件里面放的是icon.png

      來不及解釋了,上碼

      package.json

      {
        "name": "tray-demo",
        "main": "tray.html",
        "nodejs":true,
         "window": {
         "title": "trayDemo",
         "toolbar": true, 
         "width": 800, 
         "height": 600,
         "resizable":true,
         "show_in_taskbar":true,
         "frame":true,
         "kiosk":false,
         "icon": "./img/icon.png"
        },
      
        "webkit":{
          "plugin":true
        }
      }

      tray.html

      <html>
      <head>
          <title>Feynman工具</title>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      </head>
      <body >
          <h1>Feynman工具 Tray 測試</h1>
          <script>
              // Load native UI library
              var isShowWindow = true;
              // Load native UI library
              var gui = require('nw.gui');
              var win = gui.Window.get();
              var tray = new gui.Tray({ title: 'Feynman工具', icon: './img/icon.png' });
              tray.tooltip = 'Feynman工具';
              //添加一個(gè)菜單
              var menu = new gui.Menu();
              menu.append(new gui.MenuItem({ type: 'normal', label: '退出',click: function(){
                  if(confirm("確定退出Feynman工具嗎?")){
                      win.close(true);
                  }
              } }));
              tray.menu = menu;
              //click 托盤圖標(biāo)事件
              tray.on('click',
                  function()
                  {
                      if(isShowWindow)
                      {
                          win.hide();
                          isShowWindow = false;
                      }
                      else
                      {
                          win.show();
                          isShowWindow = true;
                      }
                  }
              );
              win.on('close', function () {
                win.hide();
              });
          </script> 
      </body>
      </html>

      注意icon.png最好是128x128png格式的圖片,否則可能會顯示不出來。

       最后啟動nw.exe,看看效果

      來源:https://www./content-1-596201.html

        本站是提供個(gè)人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多