Akryum / Akryum/vue-virtual-scroller

scrollbar not updating when data is added (Vue 3)

未關閉
#692 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
TypeScript
星號
10.8k
分支
973
PR 合併指標
30 天內沒有已合併 PR

描述

I'm trying to implement infinite loading the issue is that even after the data is added I can't scroll further until I scroll up a bit then its being refreshed.
here's a reproduction of the issue

I'm using
`"vue-virtual-scroller": "^2.0.0-alpha.1"`

this is my component

```


data count: {{ data.length }}

{{ item }}

import { defineComponent, ref } from 'vue';

interface record {
id: number;
name: string;
}

function generateData(startIndex: number): Array<record> {
const arr = Array<record>();
for (let i = startIndex; i < startIndex + 10; i += 1) {
arr.push({
id: i,
name: `${i} index`,
});
}
return arr;
}

export default defineComponent({
setup() {
const data = ref(generateData(0));

const handleScroll = async function ({ target }: { target: HTMLElement }) {
const { scrollTop, scrollHeight, offsetHeight } = target;

if (scrollTop === scrollHeight - offsetHeight) {
data.value.push(...generateData(data.value.length - 1));
}
};
return {
data,
handleScroll,
};
},
});

.list {
height: 200px;
}

```

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。