Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 614 Bytes

211101.md

File metadata and controls

41 lines (31 loc) · 614 Bytes

Electron 小技巧一

透明背景

const win = new BrowserWindow({
    transparent: true
});

无边框

const win = new BrowserWindow({
    frame: false,
});

任务栏上隐藏图标

const win = new BrowserWindow(config);
win.setSkipTaskbar(true);

在 vue-cli 4 中使用 ipcRenderer

由于 electron 中默认禁止使用 node 原生 api

// package.json 相同等级目录下创建 vue.config.js
module.exports = {
  pluginOptions: {
    electronBuilder: {
      // preload: "src/preload.js",
      nodeIntegration: true, // 允许使用 node
    },
  },
};