mirror of
https://github.com/imsyy/SPlayer.git
synced 2025-11-25 11:29:26 +08:00
🐞 fix: 修复窗口关闭问题 #547
This commit is contained in:
3
components.d.ts
vendored
3
components.d.ts
vendored
@@ -97,15 +97,18 @@ declare module 'vue' {
|
|||||||
NP: typeof import('naive-ui')['NP']
|
NP: typeof import('naive-ui')['NP']
|
||||||
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
||||||
NPopover: typeof import('naive-ui')['NPopover']
|
NPopover: typeof import('naive-ui')['NPopover']
|
||||||
|
NProgress: typeof import('naive-ui')['NProgress']
|
||||||
NQrCode: typeof import('naive-ui')['NQrCode']
|
NQrCode: typeof import('naive-ui')['NQrCode']
|
||||||
NRadio: typeof import('naive-ui')['NRadio']
|
NRadio: typeof import('naive-ui')['NRadio']
|
||||||
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
||||||
|
NResult: typeof import('naive-ui')['NResult']
|
||||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||||
NSelect: typeof import('naive-ui')['NSelect']
|
NSelect: typeof import('naive-ui')['NSelect']
|
||||||
NSkeleton: typeof import('naive-ui')['NSkeleton']
|
NSkeleton: typeof import('naive-ui')['NSkeleton']
|
||||||
NSlider: typeof import('naive-ui')['NSlider']
|
NSlider: typeof import('naive-ui')['NSlider']
|
||||||
NSpin: typeof import('naive-ui')['NSpin']
|
NSpin: typeof import('naive-ui')['NSpin']
|
||||||
NSwitch: typeof import('naive-ui')['NSwitch']
|
NSwitch: typeof import('naive-ui')['NSwitch']
|
||||||
|
NTab: typeof import('naive-ui')['NTab']
|
||||||
NTabPane: typeof import('naive-ui')['NTabPane']
|
NTabPane: typeof import('naive-ui')['NTabPane']
|
||||||
NTabs: typeof import('naive-ui')['NTabs']
|
NTabs: typeof import('naive-ui')['NTabs']
|
||||||
NTag: typeof import('naive-ui')['NTag']
|
NTag: typeof import('naive-ui')['NTag']
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class MainWindow {
|
|||||||
});
|
});
|
||||||
// 窗口显示时
|
// 窗口显示时
|
||||||
this.win?.on("show", () => {
|
this.win?.on("show", () => {
|
||||||
// this.mainWindow?.webContents.send("lyricsScroll");
|
this.win?.webContents.send("lyricsScroll");
|
||||||
});
|
});
|
||||||
// 窗口获得焦点时
|
// 窗口获得焦点时
|
||||||
this.win?.on("focus", () => {
|
this.win?.on("focus", () => {
|
||||||
@@ -84,9 +84,7 @@ class MainWindow {
|
|||||||
// 窗口关闭
|
// 窗口关闭
|
||||||
this.win?.on("close", (event) => {
|
this.win?.on("close", (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.win?.show();
|
this.win?.hide();
|
||||||
this.win?.focus();
|
|
||||||
this.win?.webContents.send("win-will-close");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "splayer",
|
"name": "splayer",
|
||||||
"productName": "SPlayer",
|
"productName": "SPlayer",
|
||||||
"version": "3.0.0-beta.4",
|
"version": "3.0.0-beta.5",
|
||||||
"description": "A minimalist music player",
|
"description": "A minimalist music player",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "imsyy",
|
"author": "imsyy",
|
||||||
|
|||||||
@@ -203,9 +203,6 @@ onMounted(() => {
|
|||||||
window.electron.ipcRenderer.on("win-state-change", (_event, value: boolean) => {
|
window.electron.ipcRenderer.on("win-state-change", (_event, value: boolean) => {
|
||||||
isMax.value = value;
|
isMax.value = value;
|
||||||
});
|
});
|
||||||
window.electron.ipcRenderer.on("win-will-close", () => {
|
|
||||||
tryClose();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ import { NScrollbar } from "naive-ui";
|
|||||||
import { useMusicStore, useSettingStore, useStatusStore } from "@/stores";
|
import { useMusicStore, useSettingStore, useStatusStore } from "@/stores";
|
||||||
import player from "@/utils/player";
|
import player from "@/utils/player";
|
||||||
import { getLyricLanguage } from "@/utils/lyric";
|
import { getLyricLanguage } from "@/utils/lyric";
|
||||||
|
import { isElectron } from "@/utils/env";
|
||||||
import LyricMenu from "./LyricMenu.vue";
|
import LyricMenu from "./LyricMenu.vue";
|
||||||
|
|
||||||
const musicStore = useMusicStore();
|
const musicStore = useMusicStore();
|
||||||
@@ -291,6 +292,9 @@ onMounted(() => {
|
|||||||
nextTick().then(() => {
|
nextTick().then(() => {
|
||||||
lyricsScroll(statusStore.lyricIndex);
|
lyricsScroll(statusStore.lyricIndex);
|
||||||
});
|
});
|
||||||
|
if (isElectron) {
|
||||||
|
window.electron.ipcRenderer.on("lyricsScroll", () => lyricsScroll(statusStore.lyricIndex));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user