Akryum / Akryum/vue-virtual-scroller

enhancement: offset item based on itemsize when using scrollToIndex method

Aberta
#682 3 comentários 0 reações 0 responsáveis Ver no GitHub
duplicate feature-request
Linguagem predominante
TypeScript
Estrelas
10.8k
Forks
973
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

I was running into issues where scrolling to an item index meant the item was not fully in the user's view (element was cut off). Updated `vue-virtual-scroller.esm.js ` below; not sure if the src code should be updated elsewhere but figured I would put this out for discussion at least.

```
scrollToItem (index) {
let scroll;
if (this.itemSize === null) {
scroll = index > 0 ? this.sizes[index - 1].accumulator : 0;
} else {
scroll = index * this.itemSize;
}
let { size } = this.sizes[index];
let offsetPosition = size ? scroll - size : scroll;
this.scrollToPosition(offsetPosition);
},

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.