🐞 fix: 修复搜索时 使用空格导致的空格快捷键冲突问题(#18)

fixes #18
This commit is contained in:
alger
2024-12-14 13:00:06 +08:00
parent 7365daf700
commit f9333f5f78

View File

@@ -19,6 +19,12 @@ export const playMusic = computed(() => store.state.playMusic as SongResult); //
export const sound = ref<Howl | null>(audioService.getCurrentSound());
document.onkeyup = (e) => {
// 检查事件目标是否是输入框元素
const target = e.target as HTMLElement;
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') {
return;
}
switch (e.code) {
case 'Space':
if (store.state.play) {
@@ -126,7 +132,7 @@ export const getLrcIndex = (time: number): number => {
return nowIndex.value;
};
// 获取前播放歌词进度
// 获取<EFBFBD><EFBFBD><EFBFBD>前播放歌词进度
const currentLrcTiming = computed(() => {
const start = lrcTimeArray.value[nowIndex.value] || 0;
const end = lrcTimeArray.value[nowIndex.value + 1] || start + 1;
@@ -230,7 +236,7 @@ watch(
() => lrcArray.value,
(newLrcArray) => {
if (newLrcArray.length > 0 && isElectron.value) {
// 重新初始歌词数据
// 重新初始<EFBFBD><EFBFBD>歌词数据
initLyricWindow();
// 发送当前状态
sendLyricToWin();