新消息自动滚动到底部
This commit is contained in:
parent
f79a2b2f66
commit
e269d013e2
@ -208,6 +208,7 @@ export default class Chat {
|
|||||||
}
|
}
|
||||||
return `${year}年${month}月${day}日 ${hour}:${minute}`
|
return `${year}年${month}月${day}日 ${hour}:${minute}`
|
||||||
}
|
}
|
||||||
|
const scroll = this.ul.scrollHeight === this.ul.clientHeight + this.ul.scrollTop
|
||||||
this.ul.appendChild(ListItem({
|
this.ul.appendChild(ListItem({
|
||||||
style: {
|
style: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -244,6 +245,10 @@ export default class Chat {
|
|||||||
})
|
})
|
||||||
]
|
]
|
||||||
}))
|
}))
|
||||||
|
if (scroll) {
|
||||||
|
console.log('滚动到底部')
|
||||||
|
this.ul.scrollTop = this.ul.scrollHeight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
async 存储消息(data) {
|
async 存储消息(data) {
|
||||||
// 检查id是否已经存在
|
// 检查id是否已经存在
|
||||||
|
Loading…
Reference in New Issue
Block a user