electron-vue应用build后,打开exe文件安装,成功后,打开应用报错

  1.  问题描述:

     2.解决方法:

    import {app, BrowserWindow, Menu, ipcMain, Tray,nativeImage} from 'electron'
    const path = require('path');
    //...
    const  iconPath  =  path.join(__dirname, '../../static/imgs/logo.ico')
    const  emptyPath  =  path.join(__dirname, '../../static/imgs/empty.ico')
    //使用nativeImage.createFromPath方法!!!
    const  trayUrl  =  nativeImage.createFromPath(iconPath);
    const  emptyUrl  =  nativeImage.createFromPath(emptyPath);
    let   tray  = new Tray(trayUrl);

    3.先看看本地dev有没有问题,npm run dev;
       npm run build; -> 打开build文件下的.exe文件,按照引导安装,成功后,桌面会有快捷方式

猜你喜欢

转载自blog.csdn.net/Jerryman_GHJ/article/details/82853924