fix(common): 🐛 mobile msg input focus after msg send

This commit is contained in:
wanwanruwoxin
2025-10-19 16:12:26 +08:00
parent a7b24f340c
commit 714e01bcb2
2 changed files with 16 additions and 3 deletions
+7 -2
View File
@@ -498,9 +498,14 @@ const handleVoiceClick = () => {
})
}
const handleMobileSend = () => {
send()
const handleMobileSend = async () => {
await send()
selfEmitter('send', iconClickedStates.value)
// 移动端发送消息后重新聚焦输入框
if (isMobile()) {
focusInput()
}
}
/** 导出组件方法和属性 */
+9 -1
View File
@@ -4,6 +4,7 @@ import { useDebounceFn } from '@vueuse/core'
import pLimit from 'p-limit'
import { storeToRefs } from 'pinia'
import type { Ref } from 'vue'
import { nextTick } from 'vue'
import { LimitEnum, MessageStatusEnum, MittEnum, MsgEnum, TauriCommand, UploadSceneEnum } from '@/enums'
import { useMitt } from '@/hooks/useMitt.ts'
import type { AIModel } from '@/services/types.ts'
@@ -16,7 +17,7 @@ import { messageStrategyMap } from '@/strategy/MessageStrategy.ts'
import { fixFileMimeType, getMessageTypeByFile } from '@/utils/FileType.ts'
import { processClipboardImage } from '@/utils/ImageUtils.ts'
import { getReplyContent } from '@/utils/MessageReply.ts'
import { isMac, isWindows } from '@/utils/PlatformConstants'
import { isMac, isMobile, isWindows } from '@/utils/PlatformConstants'
import { type SelectionRange, useCommon } from './useCommon.ts'
import { globalFileUploadQueue } from './useFileUploadQueue.ts'
import { useTrigger } from './useTrigger'
@@ -440,6 +441,13 @@ export const useMsgInput = (messageInputDom: Ref) => {
status: MessageStatusEnum.SENDING
})
// 移动端发送消息后重新聚焦输入框
if (isMobile()) {
nextTick(() => {
focusOn(messageInputDom.value)
})
}
try {
// 如果是图片或表情消息,需要先上传文件
if (msg.type === MsgEnum.IMAGE || msg.type === MsgEnum.EMOJI) {