diff --git a/portal-ui/src/components/VideoComposeCard.vue b/portal-ui/src/components/VideoComposeCard.vue index 66105db..98b10a4 100644 --- a/portal-ui/src/components/VideoComposeCard.vue +++ b/portal-ui/src/components/VideoComposeCard.vue @@ -1030,6 +1030,10 @@ const onEditorKeyup = (e) => { mentionActiveIndex.value = -1 return } + // 上下键由 keydown 中控制高亮索引,keyup 不应重置为首项 + if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter') { + return + } mentionVisible.value = isReference.value && hasActiveMentionTrigger() if (mentionVisible.value && e.key === '@' && mentionCandidates.value.length === 0) { Message.warning('请等待上传完成后再引用') @@ -1037,7 +1041,15 @@ const onEditorKeyup = (e) => { mentionActiveIndex.value = -1 return } - mentionActiveIndex.value = mentionVisible.value && mentionCandidates.value.length ? 0 : -1 + if (mentionVisible.value && mentionCandidates.value.length) { + const max = mentionCandidates.value.length - 1 + mentionActiveIndex.value = + mentionActiveIndex.value >= 0 + ? Math.min(mentionActiveIndex.value, max) + : 0 + } else { + mentionActiveIndex.value = -1 + } } const selectMentionItem = (item) => { diff --git a/portal-ui/src/layout/components/Menu.vue b/portal-ui/src/layout/components/Menu.vue index 4044e09..9ff8af2 100644 --- a/portal-ui/src/layout/components/Menu.vue +++ b/portal-ui/src/layout/components/Menu.vue @@ -22,15 +22,11 @@