diff --git a/components/uni-im-chat-input/uni-im-chat-input.vue b/components/uni-im-chat-input/uni-im-chat-input.vue index 0e4fbc4e629c13cf9bb5b0857cffb0967d9d08af..268d36b150ad34c82df12be7584becae176a87b4 100644 --- a/components/uni-im-chat-input/uni-im-chat-input.vue +++ b/components/uni-im-chat-input/uni-im-chat-input.vue @@ -95,13 +95,27 @@ ], emojiCodes, chatInputBoxHeight:'auto', - extToolBar: [] } }, computed: { canSend() { return typeof this.modelValue != "string" || this.modelValue.trim().length > 0; + }, + // #ifdef H5 + extToolBar(){ + // 调用扩展点,扩展程序可以在消息输入框新增一个工具类的项 + const currentConversationId = uniIm.currentConversationId + return uniIm.extensions + .invokeExts("input-msg-tool-bar",uniIm.conversation.getCached(currentConversationId)) + .filter((result) => result && result.component) + .map((result) => { + return { + component: markRaw(result.component), + props: result.props||{} + }; + }); } + // #endif }, props: { modelValue: { @@ -118,18 +132,7 @@ } }, mounted() { - // 调用扩展点,扩展程序可以在消息输入框新增一个工具类的项 - this.extToolBar = uniIm.extensions - .invokeExts("input-msg-tool-bar",this.conversation) - .filter((result) => result && result.component) - .map((result) => { - return { - component: markRaw(result.component), - props: result.props||{} - }; - }); currentModelValue = this.modelValue; - // #ifdef H5 // pc宽屏支持拖动改变输入框高度 if(uniIm.isWidescreen){