Enable "Typing..." | Disable "Typing..." |
| |
import { TUIStore, StoreName } from "@tencentcloud/chat-uikit-engine";// Enable the 'Typing' featureTUIStore.update(StoreName.APP, "enableTyping", true);// Disable the 'Typing' featureTUIStore.update(StoreName.APP, "enableTyping", false);
TUIKit/components/TUIChat/message-input/index.vue
, you can send a message to start input status via TUIChatService.enterTypingState(), and deliver a message signalling the end of the input state through 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();}};
TUIKit/components/TUIChat/chat-header/index.vue
, monitor the input state in the C2C conversation via listening to typingStatus.TUIStore.watch(StoreName.CHAT, {typingStatus: (status: boolean) => {typingStatus.value = status;switch (typingStatus.value) {case true:currentConversationName.value = "Typing...";break;case false:currentConversationName.value =currentConversation?.value?.getShowName();break;}},});
Was this page helpful?