-
Notifications
You must be signed in to change notification settings - Fork 488
Upgrade Guide
Sen Yang edited this page Aug 2, 2016
·
4 revisions
The biggest change from 1.x to 2.x is that your component no longer receives visible
or firstTimeVisible
as props. So how can your component tell whether it is visible or not? Simple, once your component has been rendered(lifecycle methods been called), it must be visible.
In the first round of rendering, LazyLoad never renders your component, instead it will render a placeholder with height specified by props. Then LazyLoad will run checkVisible
for every instance to determine which components should be rendered truly.
So bear in mind that a proper height
props for LazyLoad will improve the performance for LazyLoad very much.
- set
height
props to<LazyLoad>
component, or pass them as parameter if you used@lazyload()
decorator. - remove
wheel
ormousewheel
props, it's not longer needed. If you want to lazy load some stuff inside a overflow container, try setoverflow
props.