vue-virtual-scroller icon indicating copy to clipboard operation
vue-virtual-scroller copied to clipboard

Vue 3 DynamicScrollerItem default slot issue

Open mrsweaters opened this issue 4 years ago • 3 comments
trafficstars

When attempting to implement the DynamicScroller in Vue 3, I'm getting a TypeError: this.$slots.default is not a function exception when I attempt to render the DynamicScrollerItem component. If I remove the component, the exception goes away.

<DynamicScroller
  :items="filteredLocations"
  :min-item-size="100"
  key-field="uuid"
>
  <template v-slot="{ item, index, active }">
    <DynamicScrollerItem
      :item="item"
      :active="active"
      :size-dependencies="[
        item.properties.name,
        item.properties.address,
      ]"
      :data-index="index"
    >
      <div>{{item.uuid}}</div>
    </DynamicScrollerItem>
  </template>
</DynamicScroller>

Using version 2.0.0-alpha.1.

mrsweaters avatar Sep 12 '21 20:09 mrsweaters

I got the same issue when trying to use 2.0.0-alpha.1. My code:

    <dynamic-scroller
      :items="flatNodes"
      :min-item-size="18"
      class="w-4/4 h-4/4"
    >
      <template #default="{ item, index, active }">
        <dynamic-scroller-item
          :item="item"
          :active="active"
          :data-index="index"
          :data-active="active"
        >
          <div>
            {{ index }} - {{ active }}
          </div>
        </dynamic-scroller-item>
      </template>
    </dynamic-scroller>

Error on console: image

nntai avatar Sep 13 '21 07:09 nntai

I think PR #666 could fix this issue

nntai avatar Sep 13 '21 12:09 nntai

did this issue ever get solved?

mgershowitz avatar Apr 01 '22 14:04 mgershowitz