From b6504e114fc62dfce2a9060c4fab5727e29b55c1 Mon Sep 17 00:00:00 2001 From: zdg Date: Tue, 3 Sep 2024 16:01:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=8C=E9=9D=A2=EF=BC=8C=E5=BA=95=E9=83=A8?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=20=E5=A4=9A=E4=B8=AA=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/utils/tool.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/utils/tool.js b/src/renderer/src/utils/tool.js index 21be23c..de9b303 100644 --- a/src/renderer/src/utils/tool.js +++ b/src/renderer/src/utils/tool.js @@ -14,11 +14,11 @@ const API = isNode?window.api:{} // preload-api // import { useToolState } from '@/store/modules/tool' // 获取store状态 // const Store = isNode?require('electron-store'):null // 持久化存储 import store from './store' - // 常用变量 const BaseUrl = isNode?process.env['ELECTRON_RENDERER_URL']+'/#':'' const isDev = isNode?process.env.NODE_ENV !== 'production':'' // const toolState = useToolState() // 获取store状态 +const appPath = isNode?Remote.app.getAppPath():'' // 应用目录 // 暴露Remote中的属性 export const ipcMain = Remote?.ipcMain || {} @@ -110,6 +110,7 @@ export const createWindow = async (type, data) => { resizable: false, // 禁止窗口大小缩放 transparent: true, // 设置透明 alwaysOnTop: true, // 窗口是否总是显示在其他窗口之前 + type: 'toolbar', // 创建的窗口类型为工具栏窗口 // parent: mainWin, // 父窗口 // autoClose: true, // 关闭窗口后自动关闭 } @@ -141,8 +142,8 @@ export const createWindow = async (type, data) => { const option = data.option||{} const defOption = { frame: false, // 要创建无边框窗口 - resizable: true, // 禁止窗口大小缩放 - alwaysOnTop: false, // 窗口是否总是显示在其他窗口之前 + resizable: true, // 禁止窗口大小缩放 + alwaysOnTop: false, // 窗口是否总是显示在其他窗口之前 } data.isConsole = true // 是否开启控制台 data.option = {...defOption, ...option} @@ -179,8 +180,7 @@ export function toolWindow({url, isConsole, isWeb=true, option={}}) { return new Promise((resolve) => { const config = { width, height, - type: 'toolbar', // 创建的窗口类型为工具栏窗口 - // icon: path.join(__dirname, '../../resources/logo2.ico'), + icon: path.join(appPath, '/resources/logo2.ico'), webPreferences: { preload: path.join(API.preloadPath, '/index.js'), sandbox: false,