Fix broken chats
Co-authored-by: @ltlapy
This commit is contained in:
parent
1557d0afb8
commit
8b4be8cad1
2 changed files with 18 additions and 15 deletions
|
@ -196,21 +196,23 @@ const prepend = (item: Item): void => {
|
||||||
if (props.pagination.reversed) {
|
if (props.pagination.reversed) {
|
||||||
if (rootEl.value) {
|
if (rootEl.value) {
|
||||||
const container = getScrollContainer(rootEl.value);
|
const container = getScrollContainer(rootEl.value);
|
||||||
if (container == null) return; // TODO?
|
if (container == null) {
|
||||||
|
// TODO?
|
||||||
const pos = getScrollPosition(rootEl.value);
|
} else {
|
||||||
const viewHeight = container.clientHeight;
|
const pos = getScrollPosition(rootEl.value);
|
||||||
const height = container.scrollHeight;
|
const viewHeight = container.clientHeight;
|
||||||
const isBottom = (pos + viewHeight > height - 32);
|
const height = container.scrollHeight;
|
||||||
if (isBottom) {
|
const isBottom = (pos + viewHeight > height - 32);
|
||||||
// オーバーフローしたら古いアイテムは捨てる
|
if (isBottom) {
|
||||||
if (items.value.length >= props.displayLimit) {
|
// オーバーフローしたら古いアイテムは捨てる
|
||||||
// このやり方だとVue 3.2以降アニメーションが動かなくなる
|
if (items.value.length >= props.displayLimit) {
|
||||||
//items.value = items.value.slice(-props.displayLimit);
|
// このやり方だとVue 3.2以降アニメーションが動かなくなる
|
||||||
while (items.value.length >= props.displayLimit) {
|
//items.value = items.value.slice(-props.displayLimit);
|
||||||
items.value.shift();
|
while (items.value.length >= props.displayLimit) {
|
||||||
|
items.value.shift();
|
||||||
|
}
|
||||||
|
more.value = true;
|
||||||
}
|
}
|
||||||
more.value = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,6 +292,7 @@ definePageMetadata(computed(() => !fetching ? user ? {
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.mk-messaging-room {
|
.mk-messaging-room {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
> .body {
|
> .body {
|
||||||
.more {
|
.more {
|
||||||
|
@ -337,7 +338,7 @@ definePageMetadata(computed(() => !fetching ? user ? {
|
||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
|
|
||||||
@media (max-width: 500px) {
|
@media (max-width: 500px) {
|
||||||
bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
|
bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
|
||||||
}
|
}
|
||||||
|
|
||||||
> .new-message {
|
> .new-message {
|
||||||
|
|
Loading…
Reference in a new issue