Home > front end >  Twitter virtualscroller control problem
Twitter virtualscroller control problem

Time:11-13

Need from twitter copied above a lot of words,

Due to twitter from 2019 USES a virtualscroller controls, cause each copy words can only copy a little data,

Before no redesign can pass all to copy down more than thousand words,

Can now get to know the virtualscroller bypass control is set to true, can make the virualscroller control the properties of the closed,

And be able to render a complete text list in memory, here is making it bypass attribute description

Bypass: Boolean - Pass true to turn off VirtualScroller behaviors and just render the full list of the items.

This is the complete description virtualscroller:

https://github.com/catamphetamine/virtual-scroller

Excuse me, through what way to let bypass to true, displays full text and render a list?

CodePudding user response:

Look at the code, do not have any constructor, the parameters were not

 export default class VirtualScroller {
/* *
* @ param {function} getContainerElement - Returns the container DOM Element ` `.
* @ param {any []} The items - The list of The items.
* @ param {Object} [options] - See README, md.
* @ return {VirtualScroller}
*/
The constructor (
GetContainerElement,
The items,
The options={}//the options parameter was introduced into an object
) {
Const {
GetState
SetState,
The onStateChange,
CustomState,
//` preserveScrollPositionAtBottomOnMount ` option name is deprecated,
Home//use ` preserveScrollPositionOfTheBottomOfTheListOnMount ` option.
PreserveScrollPositionAtBottomOnMount,
ShouldUpdateLayoutOnWindowResize,
MeasureItemsBatchSize,
//` getScrollableContainer ` option is deprecated.
//Use ` scrollableContainer ` home.
GetScrollableContainer,
Tbody,
//bypassBatchSize
}=options

Let {//options above parameters of the object can be set according to the members here
Bypass,
//margin,
EstimatedItemHeight,
//getItemState,
OnItemInitialRender,
//` onItemFirstRender (I) ` is deprecated, use ` onItemInitialRender (item) home `.
OnItemFirstRender,
ScrollableContainer,
PreserveScrollPositionOfTheBottomOfTheListOnMount,
State
}=options

CodePudding user response:

 
A document he is already very clear
The first thing you need to import
The import VirtualScroller from 'virtual - scroller'

//then you need to build a new virtualScroller instance
Const virtualScroller=new virtualScroller (getContainerElement, items, options)

And he need to pass three constructor argument, including
In the options can be set in the parameter bypass

So you can use the
Const virtualScroller=new virtualScroller (getContainerElement, items, {bypass: true})

  • Related