<loading> v0.6.1+
Updated time: 14/06/2017
<loading>
为 <scroller>
和 <list>
提供上拉加载功能。用法与特性与 <refresh>
类似, 是 <scroller>
和 <list>
的子组件,且只能在被 <scroller>
和 <list>
包含时才能被正确的渲染。
子组件
<text>
<image>
<loading-indicator>
: <refresh>
和 <loading>
组件的子组件,拥有默认的动画效果的实现。
特性
display {string}
:可选值为 show
或者 hide
,仅隐藏 <indicator>
,<loading>
其他子组件依然可见,loading
事件仍会被触发。
样式
支持所有通用样式。
- 盒模型
flexbox
布局
position
opacity
background-color
查看 组件通用样式
事件
约束
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| <template> <scroller class="scroller"> <div class="cell" v-for="num in lists"> <div class="panel"> <text class="text">{{num}}</text> </div> </div> <loading class="loading" @loading="onloading" :display="showLoading"> <text class="indicator">Loading ...</text> </loading> </scroller> </template> <script> const modal = weex.requireModule('modal') const LOADMORE_COUNT = 4 export default { data () { return { showLoading: 'hide', lists: [1, 2, 3, 4, 5] } }, methods: { onloading (event) { modal.toast({ message: 'loading', duration: 1 }) this.showLoading = 'show' setTimeout(() => { const length = this.lists.length for (let i = length; i < length + LOADMORE_COUNT; ++i) { this.lists.push(i + 1) } this.showLoading = 'hide' }, 1500) } } } </script> <style scoped> .panel { width: 600px; height: 250px; margin-left: 75px; margin-top: 35px; margin-bottom: 35px; flex-direction: column; justify-content: center; border-width: 2px; border-style: solid; border-color: #DDDDDD; background-color: #F5F5F5; } .text { font-size: 50px; text-align: center; color: #41B883; } .loading { justify-content: center; } .indicator { color: #888888; font-size: 42px; padding-top: 20px; padding-bottom: 20px; text-align: center; } </style>
|
Try it