rocwang/vue-virtual-scroll-grid

[FEATURE REQUEST] enhance `scrollTo` prop if put Grid in a `overflow: auto` element

Closed this issue ยท 5 comments

In my use case, I put a Grid component in a overflow: auto element, then the prop scrollTo not working

<div style="height: 300px; overflow: auto">
  <Grid ... scrollTo="activeIndex">...</Grid>
</div>

I think the reason is the prop scrollTo is implemented with window.scrollTo.

Grid.vue: L114-L120

onUpdated(
  once(() => {
    windowScrollTo$.subscribe((next) => {
      window.scrollTo({ top: next, behavior: "smooth" });
    });
  })
);

Do you have any ideas or solutions to improve the scrollTo with my use case?

I think it should be possible by replacing window with the grid container.

Do you plan to add this functionality?

Btw, I send you one time sponsorship for this great component and your hard work. Thanks

I'll take a look this weekend. Thanks for the sponsorship! ๐Ÿ‘

@hunterliu1003

This is supported in v1.4.0 now. Let me know if you have any problem with it.

@rocwang

It just worked like a charm. Thank you for implementing this feature soooooo fast!