mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-28 10:57:23 +08:00
✨ feat:确保仅在 Electron 中调用 API 发送歌曲数据
This commit is contained in:
@@ -116,7 +116,9 @@ onMounted(async () => {
|
|||||||
// 使用 nextTick 确保 DOM 更新后再初始化
|
// 使用 nextTick 确保 DOM 更新后再初始化
|
||||||
await nextTick();
|
await nextTick();
|
||||||
initAudioListeners();
|
initAudioListeners();
|
||||||
window.api.sendSong(cloneDeep(playerStore.playMusic));
|
if (isElectron) {
|
||||||
|
window.api.sendSong(cloneDeep(playerStore.playMusic));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 初始化快捷键
|
// 初始化快捷键
|
||||||
initShortcut();
|
initShortcut();
|
||||||
|
|||||||
@@ -395,7 +395,9 @@ const setupAudioListeners = () => {
|
|||||||
// 监听播放
|
// 监听播放
|
||||||
audioService.on('play', () => {
|
audioService.on('play', () => {
|
||||||
playerStore.setPlayMusic(true);
|
playerStore.setPlayMusic(true);
|
||||||
window.api.sendSong(cloneDeep(playerStore.playMusic));
|
if (isElectron) {
|
||||||
|
window.api.sendSong(cloneDeep(playerStore.playMusic));
|
||||||
|
}
|
||||||
clearInterval();
|
clearInterval();
|
||||||
interval = window.setInterval(() => {
|
interval = window.setInterval(() => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user