Skip to content

Commit 9f0f94d

Browse files
committed
feat: optimize example
1 parent ac7455a commit 9f0f94d

File tree

1 file changed

+49
-11
lines changed

1 file changed

+49
-11
lines changed

example/src/App.vue

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
<template>
2-
<div class="wrap">
3-
<vue-loadmore
4-
:on-refresh="onRefresh"
5-
:on-loadmore="onLoad"
6-
:finished="finished"
7-
:error.sync="error"
8-
>
9-
<ul class="list-ul">
10-
<li class="list-li" v-for="(item, index) of list" :key="item">测试数据{{ index + 1 }}</li>
11-
</ul>
12-
</vue-loadmore>
2+
<div>
3+
<div class="loadmore-head">
4+
<div class="text">{{ language === 'Chinese' ? '下拉刷新上拉加载' : 'pull up and pull down' }}</div>
5+
<div class="lan" @click="changeLanguage">{{ language === 'Chinese' ? 'English' : 'Chinese' }}</div>
6+
</div>
7+
<div class="wrap">
8+
<vue-loadmore
9+
:on-refresh="onRefresh"
10+
:on-loadmore="onLoad"
11+
:finished="finished"
12+
:error.sync="error"
13+
>
14+
<ul class="list-ul">
15+
<li class="list-li" v-for="(item, index) of list" :key="item">{{ language === 'Chinese' ? '测试数据' : 'This is data' }} {{ index + 1 }}</li>
16+
</ul>
17+
</vue-loadmore>
18+
</div>
1319
</div>
1420
</template>
1521

@@ -27,6 +33,7 @@ export default {
2733
loading: false,
2834
finished: false,
2935
error: false,
36+
language: 'Chinese'
3037
};
3138
},
3239
methods: {
@@ -48,6 +55,9 @@ export default {
4855
}
4956
5057
done();
58+
},
59+
changeLanguage() {
60+
this.language = this.language === 'Chinese' ? 'English' : 'Chinese';
5161
}
5262
},
5363
destroyed() {
@@ -60,10 +70,38 @@ export default {
6070
@import './assets/reset';
6171
.wrap{
6272
padding: 20px;
73+
margin-top: 25px;
6374
// margin-top: 100px;
6475
// overflow: auto;
6576
// height: 500px;
6677
}
78+
.loadmore-head {
79+
position: absolute;
80+
top: 0;
81+
right: 0;
82+
left: 0;
83+
background: #fff;
84+
overflow: hidden;
85+
min-width: 30px;
86+
height: 45px;
87+
text-align: center;
88+
text-overflow: ellipsis;
89+
white-space: nowrap;
90+
box-shadow: 0 0 10px rgba(0,0,0,.05);
91+
z-index: 2;
92+
.text {
93+
font-size: 17px;
94+
font-weight: 500;
95+
line-height: 45px;
96+
}
97+
.lan {
98+
position: absolute;
99+
right: 12px;
100+
bottom: 10px;
101+
font-size: 14px;
102+
cursor: pointer;
103+
}
104+
}
67105
.list-ul {
68106
.list-li {
69107
height: 50px;

0 commit comments

Comments
 (0)