优化代码逻辑,修复潜在播放问题

This commit is contained in:
lyswhut
2023-01-14 16:03:56 +08:00
parent d3c8f16aed
commit 850a429243
35 changed files with 85 additions and 342 deletions
@@ -125,14 +125,14 @@ export default {
let lxlyric = props.lyricInfo.lxlyric
if (offsetTagRxp.test(lyric)) {
lyric = lyric.replace(offsetTagAllRxp, `$1[offset:${offset}]`)
if (tlyric) tlyric = tlyric.replace(offsetTagAllRxp, `$1[offset:${offset}]`)
if (lxlyric) lxlyric = lxlyric.replace(offsetTagAllRxp, `$1[offset:${offset}]`)
if (rlyric) rlyric = rlyric.replace(offsetTagAllRxp, `$1[offset:${offset}]`)
tlyric &&= tlyric.replace(offsetTagAllRxp, `$1[offset:${offset}]`)
lxlyric &&= lxlyric.replace(offsetTagAllRxp, `$1[offset:${offset}]`)
rlyric &&= rlyric.replace(offsetTagAllRxp, `$1[offset:${offset}]`)
} else {
lyric = `[offset:${offset}]\n` + lyric
if (tlyric) tlyric = `[offset:${offset}]\n` + tlyric
if (lxlyric) lxlyric = `[offset:${offset}]\n` + lxlyric
if (rlyric) rlyric = `[offset:${offset}]\n` + rlyric
lyric &&= `[offset:${offset}]\n` + lyric
tlyric &&= `[offset:${offset}]\n` + tlyric
lxlyric &&= `[offset:${offset}]\n` + lxlyric
rlyric &&= `[offset:${offset}]\n` + rlyric
}
const musicInfo = 'progress' in props.lyricInfo.musicInfo ? props.lyricInfo.musicInfo.meta.musicInfo : props.lyricInfo.musicInfo
@@ -64,7 +64,7 @@ export default {
}
const handleSearch = () => {
if (visibleList.value) visibleList.value = false
visibleList.value &&= false
if (!searchText.value && route.path != '/search') {
setSearchText('')
return
@@ -83,13 +83,13 @@ export default {
switch (action) {
case 'focus':
isFocused = true
if (!visibleList.value) visibleList.value = true
visibleList.value ||= true
if (searchText.value) handleTipSearch()
break
case 'blur':
isFocused = false
setTimeout(() => {
if (visibleList.value) visibleList.value = false
visibleList.value &&= false
}, 50)
break
case 'submit':