tangbc / vue-virtual-scroll-list

⚡️A vue component support big amount data list with high render performance and efficient.
https://tangbc.github.io/vue-virtual-scroll-list
MIT License
4.41k stars 593 forks source link

Vue virtual scroll list not showing all list items #369

Open Osman-Rafi opened 2 years ago

Osman-Rafi commented 2 years ago

I'm trying to use vue-virtual-scroll-list component on my app for implementing virtual scroll. However, it's not working as expected. It only showing some data's instead of showing all data with a minimal DOM.

Here is my code:

<virtual-list
      v-show="!!tempItems.length"
      ref="vsl"
      :data-key="'id'"
      :data-sources="tempItems"
      :data-component="childComponent"
      :estimate-size="100"
    />

the child component

<template>
  <div>{{ index }} -> {{ source.message }}</div>
</template>

this only showing the first 30 items.

Codesandbox: https://codesandbox.io/s/practical-cloud-57119?file=/src/App.vue

baseballyama commented 2 years ago

According to the README, you need to add like style="height: 600px; overflow-y: auto;". (You can set height what you want.)

<virtual-list
  v-show="!!tempItems.length"
  ref="vsl"
  :data-key="'id'"
  :data-sources="tempItems"
  :data-component="childComponent"
  :estimate-size="100"
  style="height: 600px; overflow-y: auto;"
/>
Osman-Rafi commented 2 years ago

This creates an extra scrollbar. With scroll newly created scrollbar moves, however, the page scrollbar stays same.

image

bLind17 commented 2 years ago

I have the same problem, looks like https://github.com/tangbc/vue-virtual-scroll-list/issues/345 to me. Not sure if this will be fixed when looking at the timestamp of the issue^^