feat: 优化播放逻辑

This commit is contained in:
alger
2026-02-06 20:34:07 +08:00
parent 0e47c127fe
commit b955e95edc
7 changed files with 227 additions and 138 deletions
+13
View File
@@ -125,6 +125,19 @@ onMounted(async () => {
if (isLyricWindow.value) {
return;
}
// 检查网络状态,离线时自动跳转到本地音乐页面
if (!navigator.onLine) {
console.log('检测到无网络连接,跳转到本地音乐页面');
router.push('/local-music');
}
// 监听网络状态变化,断网时跳转到本地音乐页面
window.addEventListener('offline', () => {
console.log('网络连接断开,跳转到本地音乐页面');
router.push('/local-music');
});
// 初始化 MusicHook,注入 playerStore
initMusicHook(playerStore);
// 初始化播放状态