bug修复
This commit is contained in:
parent
eb7b4e963f
commit
2e4e30abc0
@ -85,13 +85,22 @@ const emits = defineEmits(['onDeleteSuccess', 'onRefresh', 'onEdit','update:list
|
|||||||
/** 滚动到底部 */
|
/** 滚动到底部 */
|
||||||
const scrollToBottom = async (isIgnore?: boolean) => {
|
const scrollToBottom = async (isIgnore?: boolean) => {
|
||||||
// 注意要使用 nextTick 以免获取不到 dom
|
// 注意要使用 nextTick 以免获取不到 dom
|
||||||
await nextTick()
|
await nextTick();
|
||||||
|
setTimeout(() => {
|
||||||
if (isIgnore || !isScrolling.value) {
|
if (isIgnore || !isScrolling.value) {
|
||||||
messageContainer.value.scrollTop =
|
const container = messageContainer.value;
|
||||||
messageContainer.value.scrollHeight - messageContainer.value.offsetHeight
|
if (container) {
|
||||||
|
container.scrollTop = container.scrollHeight - container.offsetHeight;
|
||||||
|
console.log('ScrollTop:', container.scrollTop);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(list, () => {
|
||||||
|
nextTick();
|
||||||
|
scrollToBottom();
|
||||||
|
}, { deep: true });
|
||||||
function handleScroll() {
|
function handleScroll() {
|
||||||
const scrollContainer = messageContainer.value
|
const scrollContainer = messageContainer.value
|
||||||
const scrollTop = scrollContainer.scrollTop
|
const scrollTop = scrollContainer.scrollTop
|
||||||
|
Loading…
Reference in New Issue
Block a user