The <loading>
Component provide a pullup to loading function for some special containers, its usage and attributes are similar to the <refresh>
Component.
Note: To be rendered properly, the
<loading>
Component must appear inside the special Component such as<scroller>
、<list>
、<hlist>
、<vlist>
、<waterfall>
.
<list> ... ... <loading> ... </loading> </list>
Any other components, like the <text>
and <image>
components, can be put inside the loading component.
<loading-indicator>
: This is a dedicated component which provides a default loading animation effect, can only be used inside the <refresh>
or the <loading>
components.
Example:
<loading> <text>Loading</text> <loading-indicator></loading-indicator> ... </loading>
Attribute | Type | Value | Default Value |
---|---|---|---|
display | String | show / hide | show |
display
show
:The loading animation will be started if a <loading-indicator>
is included in the loading component.
hide
:Collapse the loading view. It also hides the <loading-indicator>
and stops the loading animation if there's a <loading-indicator>
included in the loading component.
Note: The visibility of
<loading>
component can be controlled by display attribute with the value show and hide. Adisplay="show"
should always be paired with adisplay="hide"
statement.
<template> <list> ... ... <loading @loading="onloading" :display="loadinging ? 'show' : 'hide'"> ... </loading> ... </list> </template> <script> ... methods: { onloading (event) { this.loadinging = true setTimeout(() => { this.loadinging = false }, 2000) }, } </script>
loading
Triggered when the scroller or list is pulled up.
Complete example goes here