优化代码逻辑,修复潜在播放问题
This commit is contained in:
@@ -56,7 +56,7 @@ export default {
|
||||
}
|
||||
const handleMsMove = event => {
|
||||
if (!msEvent.isMsDown) return
|
||||
if (!dragging.value) dragging.value = true
|
||||
dragging.value ||= true
|
||||
|
||||
let progress = msEvent.msDownProgress + (event.clientX - msEvent.msDownX) / dom_progress.value.clientWidth
|
||||
if (progress > 1) progress = 1
|
||||
|
||||
@@ -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':
|
||||
|
||||
@@ -12,16 +12,16 @@ const useKeyEvent = ({ handleSelectAllData }: {
|
||||
}
|
||||
|
||||
const handle_key_shift_down = () => {
|
||||
if (!keyEvent.isShiftDown) keyEvent.isShiftDown = true
|
||||
keyEvent.isShiftDown ||= true
|
||||
}
|
||||
const handle_key_shift_up = () => {
|
||||
if (keyEvent.isShiftDown) keyEvent.isShiftDown = false
|
||||
keyEvent.isShiftDown &&= false
|
||||
}
|
||||
const handle_key_mod_down = () => {
|
||||
if (!keyEvent.isModDown) keyEvent.isModDown = true
|
||||
keyEvent.isModDown ||= true
|
||||
}
|
||||
const handle_key_mod_up = () => {
|
||||
if (keyEvent.isModDown) keyEvent.isModDown = false
|
||||
keyEvent.isModDown &&= false
|
||||
}
|
||||
const handle_key_mod_a_down = ({ event }: LX.KeyDownEevent) => {
|
||||
if (!event || (event.target as HTMLElement).tagName == 'INPUT') return
|
||||
|
||||
Reference in New Issue
Block a user