mirror of
https://github.com/HuLaSpark/HuLa.git
synced 2026-10-25 09:52:12 +08:00
fix(common): 🐛 mobile msg input focus after msg send
This commit is contained in:
@@ -498,9 +498,14 @@ const handleVoiceClick = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleMobileSend = () => {
|
||||
send()
|
||||
const handleMobileSend = async () => {
|
||||
await send()
|
||||
selfEmitter('send', iconClickedStates.value)
|
||||
|
||||
// 移动端发送消息后重新聚焦输入框
|
||||
if (isMobile()) {
|
||||
focusInput()
|
||||
}
|
||||
}
|
||||
|
||||
/** 导出组件方法和属性 */
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user