fix: safe router.back() — fallback to home if no history (prevents navigating to external site)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
saopig1andClaude Opus 4.6 committed 2026-03-30 14:57:32 +08:00
1 parent eb0088d110
commit 7d329a0db1
2 files changed
+17 -2

No files matched your search

+6 -1
View File
@@ -89,7 +89,12 @@ const currentSong = computed(() => store.currentSong);
function toggleLyrics() {
if (route.path === '/lyrics') {
router.back();
// Go back if there's history, otherwise go home
if (window.history.length > 1) {
router.back();
} else {
router.push('/');
}
} else {
router.push('/lyrics');
}