Browse Source

聊天键盘保持

master
xie.bx 3 years ago
parent
commit
9443b1e80e
  1. 24
      im-uniapp/pages/chat/chat-box.vue

24
im-uniapp/pages/chat/chat-box.vue

@ -4,7 +4,7 @@
<text class="title">{{title}}</text>
<uni-icons class="btn-side" type="more-filled" size="30"></uni-icons>
</view>
<view class="chat-msg" @click="switchChatTabBox('none')">
<view class="chat-msg" @click="switchChatTabBox('none',false)">
<scroll-view class="scroll-box" scroll-y="true" :scroll-into-view="'chat-item-'+scrollMsgIdx">
<view v-for="(msgInfo,idx) in chat.messages" :key="idx">
<chat-message-item :headImage="headImage(msgInfo)" :showName="showName(msgInfo)"
@ -16,12 +16,12 @@
<view class="send-bar">
<view class="iconfont icon-voice-circle"></view>
<view class="send-text">
<textarea class="send-text-area" v-model="sendText" auto-height :show-confirm-bar="false" :focus="sendTextFocus" @blur="onSendTextBlur()"
@focus="onSendTextFoucs()" cursor-spacing="20" @keydown.enter="sendTextMessage()" @click="switchChatTabBox('none')"></textarea>
<textarea class="send-text-area" v-model="sendText" auto-height :show-confirm-bar="false" :focus="sendTextFocus"
@focus="onSendTextFoucs()" cursor-spacing="20" @keydown.enter="sendTextMessage()" @click="switchChatTabBox('none',true)" :hold-keyboard="sendTextFocus"></textarea>
</view>
<view class="iconfont icon-icon_emoji" @click="switchChatTabBox('emo')"></view>
<view v-show="sendText==''" class="iconfont icon-add-circle" @click="switchChatTabBox('tools')"></view>
<button v-show="sendText!=''" class="btn-send" type="primary" @click="sendTextMessage()"
<view class="iconfont icon-icon_emoji" @click="switchChatTabBox('emo',false)"></view>
<view v-show="sendText==''" class="iconfont icon-add-circle" @click="switchChatTabBox('tools',false)"></view>
<button v-show="sendText!=''" class="btn-send" type="primary" @touchend.prevent="sendTextMessage()"
size="mini">发送</button>
</view>
@ -130,7 +130,7 @@
//
this.scrollToBottom();
//
this.sendTextFocus = true;
//this.sendTextFocus = true;
});
},
fillTargetId(msgInfo, targetId) {
@ -162,16 +162,16 @@
});
},
switchChatTabBox(v) {
this.chatTabBox = v;
switchChatTabBox(chatTabBox,sendTextFocus) {
console.log("switchChatTabBox")
this.chatTabBox = chatTabBox;
this.sendTextFocus = sendTextFocus
this.scrollToBottom();
console.log(this.sendTextFocus)
},
selectEmoji(emoText) {
this.sendText += `#${emoText};`;
},
onSendTextBlur(){
this.sendTextFocus=false;
},
onSendTextFoucs(){
console.log("onSendTextFoucs")
this.scrollToBottom();

Loading…
Cancel
Save