phphe / virtual-list

Vue virtual list. Also supports horizontal list, virtual table, React.
https://virtual-list.phphe.com/
18 stars 3 forks source link

Undefined error even though passing valid array #5

Open ben1499 opened 5 months ago

ben1499 commented 5 months ago

I'm getting the error: [Vue warn]: Error in setup: "TypeError: Cannot read properties of undefined (reading 'length')". But the options array I'm passing is valid and i haven't read the length property anywhere.

It was working initially, but after i generated new js bundle it stopped working. I'm on Vue 2.7.16 I have also installed the @vue/composition-api package during initial setup.

This is the import I'm using import VList from '@virtual-list/vue/vue2'

Code:

 <VList
    ref="list"
    :items="options"
    :first-render="10"
    item-key="index"
    class="scroller"
  >
</Vlist>
phphe commented 5 months ago

it is caused by vue2.7. Vue 2.7 support reactive like @vue/composition-api except arrays. So you need downgrade to Vue2.6 and regenrate.

ben1499 commented 5 months ago

it is caused by vue2.7. Vue 2.7 support reactive like @vue/composition-api except arrays. So you need downgrade to Vue2.6 and regenrate.

Okay thanks I'll try that