开启“对方正在输入” | 关闭“对方正在输入” |
| |
import { TUIStore, StoreName } from "@tencentcloud/chat-uikit-engine";// 开启对方正在输入// enable typingTUIStore.update(StoreName.APP, "enableTyping", true);// 关闭对方正在输入// disable typingTUIStore.update(StoreName.APP, "enableTyping", false);
TUIKit/components/TUIChat/message-input/index.vue
, 可以通过 TUIChatService.enterTypingState() 发送开启输入状态,通过 TUIChatService.leaveTypingState() 发送结束输入状态。// TUIKit/components/TUIChat/message-input/index.vueconst onTyping = (inputContentEmpty: boolean, inputBlur: boolean) => {sendTyping(inputContentEmpty, inputBlur);};// TUIKit/components/TUIChat/utils/sendMessage.tsexport const sendTyping = (inputContentEmpty: boolean, inputBlur: boolean) => {if (!inputContentEmpty && !inputBlur) {TUIChatService.enterTypingState();} else {TUIChatService.leaveTypingState();}};
TUIStore.watch(StoreName.CHAT, {typingStatus: (status: boolean) => {typingStatus.value = status;switch (typingStatus.value) {case true:currentConversationName.value =TUITranslateService.t("TUIChat.对方正在输入");break;case false:currentConversationName.value =currentConversation?.value?.getShowName();break;}},});
本页内容是否解决了您的问题?