The default value for most of properties can be overridden through the Plugin API.
Number
100
The infinite
event will be fired if the scroll distance is less than this value. If direction
is set to top
, it will calculate the distance between the scroll bar and the top, if direction
is set to bottom
, it will calculate the distance between the scroll bar and the bottom.
String
default
default
| spiral
| circles
| bubbles
| waveDots
This property is used to set the loading animation, you can choose one from the internal spinners that you like, you can also customize it with a named slot that called spinner
.
String
bottom
top
| bottom
This property is used to set the load direction.
Boolean
| String
false
By default, the component will search for the closest parent element which has overflow-y: auto | scroll
CSS style as the scroll container, this property is used to force to specify the scroll container, usually used when the case has complex layout or 3rd-party scroll plugin (eg: perfect-scrollbar
).
If this value set be true
, the component will search the closest parent element which has infinite-wrapper
attribute as the scroll container, if this value is a string, the component will use it as a CSS selector, and search the element as the scroll container via the querySelector
API, if all failed, the component will use window
as the scroll container.
any
+new Date()
The component will be reset if this property has changed, just like recreating a new component, usually used when the case has filter or tabs.
The contents for these slots can be configured via the slot
special attribute, also can be configure via the plugin API.
No results :(
This message will be displayed if there is no data, it means we did not call the $state.loaded
method before calling the $stat.complete
method.
No more data :)
This message will be displayed if there is no more data, it means we called the $state.loaded
method before calling the $state.complete
method.
Opps, something went wrong :( <br> <button>Retry</button>
This message will be displayed if loading failed, it means we called the $state.error
method.
Internal Spinner
This slot will be displayed when loading data, you can customize your own spinner through it.
event
This event will be fired if the scroll distance is less than the distance
property, the component will pass a special event argument for the event handler to change loading status, usually we name it $state
, include these methods:
Inform the component that this loading has been successful, and the infinite
event will be fired again if the first screen was not be filled up, otherwise, the component will hide the loading animation and continue to listen scroll event.
Inform the component that all the data has been loaded successfully, if the $state.loaded
method has not been called before this, the content of no-results
slot will be displayed, otherwise, the content of no-more
slot will be displayed.
Inform the component that this loading failed, the content of error
slot will be displayed.
Reset the component, same as changing the identifier
property.
You can configure all these plugin options via the plugin API.
String
Configure the default value for spinner
property.
Number
Configure the default value for distance
property.
WARNING
This option is read with a lower priority than Options - slots.spinner, it means if you configure slots.spinner
correctly, this option will never take effect
Boolean
| String
Configure the default value for forceUseInfiniteWrapper
property.
String
| Vue Component
Configure the default content for no-results
slot.
String
| Vue Component
Configure the default content for no-more
slot.
String
| Vue Component
Configure the default content for error
slot.
String
Retry
Configure the default text for retry button in the default error
slot. Please note, it won't work if you customize the error
slot, you need to configure retry button yourself.
String
| Vue Component
Configure the default content for spinner
slot.
Number
50
Configure the default throttle space of time for scroll
event (unit: ms).