diff --git a/index.html b/index.html index 379b6fb..f6a1884 100644 --- a/index.html +++ b/index.html @@ -3,8 +3,9 @@ + - + 优享地图 diff --git a/src/views/IndexChat.vue b/src/views/IndexChat.vue index 5fd2b7c..a7b3840 100644 --- a/src/views/IndexChat.vue +++ b/src/views/IndexChat.vue @@ -255,14 +255,14 @@ -
+
-
@@ -308,6 +308,10 @@ const cksend = (val) => { } } +const handleInputFocus = () => { + console.log("聚焦了"); + scollToButtom(); +} const sendMessage = () => { console.log("信息发送成功", inputText.value); let messageValue = inputText.value.trim() @@ -370,12 +374,24 @@ const goke = () => { const bookDoctor = () => { location.href = 'https://wx.nbgzjk.cn/#/home' }; +// const scollToButtom = () => { +// nextTick(() => { +// let chatForm = document.getElementById('chatform'); // 获取对象 +// if (chatForm) { +// chatForm.scrollTop = chatForm.scrollHeight+99999; // 滚动高度 +// console.log("滚动",chatForm.scrollTop); +// } +// }); +// } const scollToButtom = () => { nextTick(() => { - let chatForm = document.getElementById('chatform'); // 获取对象 - if (chatForm) { - chatForm.scrollTop = chatForm.scrollHeight; // 滚动高度 - } + setTimeout(() => { // 增加延迟等待页面布局调整 + let chatForm = document.getElementById('chatform'); + if (chatForm) { + chatForm.scrollTop = chatForm.scrollHeight - chatForm.clientHeight; // 调整滚动逻辑 + console.log("滚动", chatForm.scrollTop); + } + }, 300); // 延迟时间可以根据实际情况调整 }); } /* watch(inputText, (newValue, oldValue) => {