diff --git a/aiChat/components/bottomSend.vue b/aiChat/components/bottomSend.vue index 280312a..f2baed1 100644 --- a/aiChat/components/bottomSend.vue +++ b/aiChat/components/bottomSend.vue @@ -3,6 +3,9 @@ :class="{ 'focus': inputOnFocus }" + :style="{ + 'transform': 'translateY(-' + (keyboardHeight + 'px') + ')' + }" class="fix-page-bottom" > @@ -26,6 +29,7 @@ { + console.log('监听键盘高度变化%s', res.height) + this.keyboardHeight = res.height + }) + }, onUnload() { this.closeWsFn() + // console.log('在页面卸载时取消监听') + // wx.offKeyboardHeightChange() }, created() { const _this = this @@ -215,7 +225,9 @@ export const chatMixins = { }, closeWsFn() { this.loading = false - this.chatMessageList[this.chatMessageListLength - 1].showCursor = false + if (this.chatMessageListLength) { + this.chatMessageList[this.chatMessageListLength - 1].showCursor = false + } uni.closeSocket({ success: () => { console.log('-----关闭连接') diff --git a/aiChat/views/history.vue b/aiChat/views/history.vue index 93f38e9..49480dd 100644 --- a/aiChat/views/history.vue +++ b/aiChat/views/history.vue @@ -134,6 +134,9 @@ :class="{ 'focus': onFocus }" + :style="{ + 'transform': 'translateY(-' + (keyboardHeight + 'px') + ')' + }" class="page-to-bottom" >