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