diff --git a/components.d.ts b/components.d.ts index 94e7b9f..f9850a4 100644 --- a/components.d.ts +++ b/components.d.ts @@ -97,15 +97,18 @@ declare module 'vue' { NP: typeof import('naive-ui')['NP'] NPopconfirm: typeof import('naive-ui')['NPopconfirm'] NPopover: typeof import('naive-ui')['NPopover'] + NProgress: typeof import('naive-ui')['NProgress'] NQrCode: typeof import('naive-ui')['NQrCode'] NRadio: typeof import('naive-ui')['NRadio'] NRadioGroup: typeof import('naive-ui')['NRadioGroup'] + NResult: typeof import('naive-ui')['NResult'] NScrollbar: typeof import('naive-ui')['NScrollbar'] NSelect: typeof import('naive-ui')['NSelect'] NSkeleton: typeof import('naive-ui')['NSkeleton'] NSlider: typeof import('naive-ui')['NSlider'] NSpin: typeof import('naive-ui')['NSpin'] NSwitch: typeof import('naive-ui')['NSwitch'] + NTab: typeof import('naive-ui')['NTab'] NTabPane: typeof import('naive-ui')['NTabPane'] NTabs: typeof import('naive-ui')['NTabs'] NTag: typeof import('naive-ui')['NTag'] diff --git a/electron/main/windows/main-window.ts b/electron/main/windows/main-window.ts index 67945d8..6c32c70 100644 --- a/electron/main/windows/main-window.ts +++ b/electron/main/windows/main-window.ts @@ -44,7 +44,7 @@ class MainWindow { }); // 窗口显示时 this.win?.on("show", () => { - // this.mainWindow?.webContents.send("lyricsScroll"); + this.win?.webContents.send("lyricsScroll"); }); // 窗口获得焦点时 this.win?.on("focus", () => { @@ -84,9 +84,7 @@ class MainWindow { // 窗口关闭 this.win?.on("close", (event) => { event.preventDefault(); - this.win?.show(); - this.win?.focus(); - this.win?.webContents.send("win-will-close"); + this.win?.hide(); }); } /** diff --git a/package.json b/package.json index 62fe5e7..59cb937 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "splayer", "productName": "SPlayer", - "version": "3.0.0-beta.4", + "version": "3.0.0-beta.5", "description": "A minimalist music player", "main": "./out/main/index.js", "author": "imsyy", diff --git a/src/components/Layout/Nav.vue b/src/components/Layout/Nav.vue index fd2be63..61a691e 100644 --- a/src/components/Layout/Nav.vue +++ b/src/components/Layout/Nav.vue @@ -203,9 +203,6 @@ onMounted(() => { window.electron.ipcRenderer.on("win-state-change", (_event, value: boolean) => { isMax.value = value; }); - window.electron.ipcRenderer.on("win-will-close", () => { - tryClose(); - }); } }); diff --git a/src/components/Player/MainLyric.vue b/src/components/Player/MainLyric.vue index 4d64ce8..08468eb 100644 --- a/src/components/Player/MainLyric.vue +++ b/src/components/Player/MainLyric.vue @@ -169,6 +169,7 @@ import { NScrollbar } from "naive-ui"; import { useMusicStore, useSettingStore, useStatusStore } from "@/stores"; import player from "@/utils/player"; import { getLyricLanguage } from "@/utils/lyric"; +import { isElectron } from "@/utils/env"; import LyricMenu from "./LyricMenu.vue"; const musicStore = useMusicStore(); @@ -291,6 +292,9 @@ onMounted(() => { nextTick().then(() => { lyricsScroll(statusStore.lyricIndex); }); + if (isElectron) { + window.electron.ipcRenderer.on("lyricsScroll", () => lyricsScroll(statusStore.lyricIndex)); + } }); onBeforeUnmount(() => {