# 上拉加载
用于表达页面刷新时的状态。
# 示例
<template>
<div class="dof-demo">
<dof-minibar title="6.3 上拉加载"></dof-minibar>
<scroller class="scroller">
<div class="cell" v-for="num in lists" :key="num">
<div class="panel"></div>
</div>
<loading class="loading" @loading="onloading" :display="loadinging ? 'show' : 'hide'" v-if="nextPageFlag">
<!-- <text class="indicator-text">Loading ...</text> -->
<midea-lottie-view ref="lottieView" class="indicator" :data="loadJson" :loop="true"></midea-lottie-view>
</loading>
<text class="tips" v-if="!nextPageFlag">- 没有更多内容了 - </text>
</scroller>
</div>
</template>
<style scoped>
.dof-demo {
background-color: #151617;
}
.loading {
width: 750;
display: -ms-flex;
display: -webkit-flex;
display: flex;
-ms-flex-align: center;
-webkit-align-items: center;
-webkit-box-align: center;
align-items: center;
padding-bottom: 40px;
}
.indicator-text {
color: #888888;
font-size: 42px;
text-align: center;
}
.indicator {
margin-top: 16px;
height: 72px;
width: 88px;
}
.panel {
width: 686px;
height: 344px;
margin-left: 32px;
margin-top: 35px;
margin-bottom: 35px;
flex-direction: column;
justify-content: center;
background-color: #1d1f22;
}
.text {
font-size: 50px;
text-align: center;
color: #41b883;
}
.tips {
color: #8a8a8f;
font-size: 24px;
margin-top: 80px;
padding-bottom: 80px;
text-align: center;
}
</style>
<script>
import { DofMinibar } from 'dolphin-weex-ui'
const modal = weex.requireModule('modal')
import lottieData from './loading'
export default {
components: { DofMinibar },
data: () => ({
loadinging: false,
maxPage: 3,
currPage: 1,
pageSize: 5,
lists: [0, 1, 2, 3, 4],
nextPageFlag: true,
loadJson: JSON.stringify(lottieData)
}),
created() {},
computed: {},
mounted() {},
methods: {
onloading() {
modal.toast({ message: 'Loading' })
this.loadinging = true
setTimeout(() => {
this.initData()
this.loadinging = false
}, 2000)
},
initData() {
if (this.currPage >= this.maxPage) {
this.nextPageFlag = false
return
}
for (let i = this.currPage * this.pageSize; i < (this.currPage + 1) * this.pageSize; i++) {
this.lists.push(i)
}
this.currPage += 1
}
}
}
</script>
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# loading资源路径
点我扫二维码 查看demo