mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-16 07:38:18 +09:00
fix(client): Pagination prepend not working on containers without scrolling
This commit is contained in:
parent
aabf12038c
commit
c58f2a7d15
@ -192,21 +192,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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user