refactor: improve code quality in Playroom.vue
- Use Number.isNaN instead of isNaN for better type safety - Convert anonymous function to arrow function for consistency - Add explicit braces to single-line if statement for clarity 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
6461c0adac
commit
1c5ee95086
|
@ -93,7 +93,7 @@ function timeFormatter(time: number) {
|
||||||
if (timeInSeconds < 0) { return '-:--' }
|
if (timeInSeconds < 0) { return '-:--' }
|
||||||
const minutes = Math.floor(timeInSeconds / 60)
|
const minutes = Math.floor(timeInSeconds / 60)
|
||||||
const seconds = Math.floor(timeInSeconds % 60)
|
const seconds = Math.floor(timeInSeconds % 60)
|
||||||
if (isNaN(minutes) || isNaN(seconds)) { return '-:--' }
|
if (Number.isNaN(minutes) || Number.isNaN(seconds)) { return '-:--' }
|
||||||
return `${minutes}:${seconds < 10 ? '0' : ''}${seconds}`
|
return `${minutes}:${seconds < 10 ? '0' : ''}${seconds}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ function createVolumeDraggable() {
|
||||||
// 保存音量到localStorage
|
// 保存音量到localStorage
|
||||||
localStorage.setItem('audioVolume', newVolume.toString())
|
localStorage.setItem('audioVolume', newVolume.toString())
|
||||||
},
|
},
|
||||||
onDragEnd: function () {
|
onDragEnd: () => {
|
||||||
// 拖拽结束时也保存一次
|
// 拖拽结束时也保存一次
|
||||||
localStorage.setItem('audioVolume', volume.value.toString())
|
localStorage.setItem('audioVolume', volume.value.toString())
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,7 @@ function setupPageFocusHandlers() {
|
||||||
// 重新同步歌词状态
|
// 重新同步歌词状态
|
||||||
function resyncLyricsState() {
|
function resyncLyricsState() {
|
||||||
const currentTrack = getCurrentTrack()
|
const currentTrack = getCurrentTrack()
|
||||||
if (!currentTrack) return
|
if (!currentTrack) { return }
|
||||||
|
|
||||||
console.log('[Playroom] 重新同步歌词状态')
|
console.log('[Playroom] 重新同步歌词状态')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user