Skip to content

Commit

Permalink
Merge pull request #169 from SeasonsChange422/Br_develop_v1.0
Browse files Browse the repository at this point in the history
消息框自动下拉
  • Loading branch information
SeasonsChange422 authored Aug 13, 2024
2 parents f33463e + 8a4ecc5 commit 879a7c8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Mixi-ui/src/views/demo/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</div>
</div>
<div style="width: 70%;height: 100%;">
<div style="height: 90%;width: 100%;overflow-y: scroll;">
<div style="height: 90%;width: 100%;overflow-y: scroll;" ref="chatScrollBox">
<div style="width: 100%;min-height: 70px;border: none;" v-for="(msg,index) in messageArray" :key="index">
<messageComponent :message="msg"></messageComponent>
</div>
Expand All @@ -51,6 +51,7 @@ import { storage } from '@/util/storage';
import messageComponent from '@/components/room/messageComponent.vue';
let invite = ref(false)
let inviteEmail = ref<String[]>([])
let chatScrollBox = ref<any>()
onMounted(() => {
for (let i = 0; i < 20; i++)inviteEmail.value[i] = ''
})
Expand Down Expand Up @@ -109,6 +110,9 @@ socket.onmessage((event: any) => {
messageArray.value.push(msg)
console.log(messageArray.value)
})
setTimeout(()=>{
chatScrollBox.value.scrollTop = chatScrollBox.value.scrollHeight;
},100)
})
socket.init()
Expand Down

0 comments on commit 879a7c8

Please sign in to comment.