Skip to content

Commit 13672a7

Browse files
committed
Added select for items by page
1 parent fc3db43 commit 13672a7

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

src/components/TinyPagination.vue

+37-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
<li class="page-item" :class="classLastPage">
1111
<a href="#" @click.prevent="nextPage">{{translation.next}}</a>
1212
</li>
13+
<li class="page-item">
14+
<select class="tiny-form-select" v-model="limit">
15+
<option
16+
v-for="(limit, index) in limits"
17+
:value="limit"
18+
:key="index">{{limit}}/{{translation.title}}</option>
19+
</select>
20+
</li>
1321
</ul>
1422
</div>
1523
</template>
@@ -37,7 +45,9 @@ export default {
3745
},
3846
data () {
3947
return {
40-
currentPage: 1
48+
currentPage: 1,
49+
limit: 10,
50+
limits: [10, 15, 20, 50, 100]
4151
}
4252
},
4353
created () {
@@ -48,7 +58,7 @@ export default {
4858
return Language.translations[this.lang]
4959
},
5060
totalPages () {
51-
return Math.ceil(this.total/10)
61+
return Math.ceil(this.total/this.limit)
5262
},
5363
titlePage () {
5464
return `${this.translation.title} ${this.currentPage}`
@@ -150,5 +160,30 @@ export default {
150160
opacity: .5;
151161
}
152162
}
163+
164+
.tiny-form-select {
165+
-webkit-appearance: none;
166+
-moz-appearance: none;
167+
appearance: none;
168+
text-transform: lowercase;
169+
border: .05rem solid #caced7;
170+
border-radius: .1rem;
171+
font-size: .8rem;
172+
height: 1.8rem;
173+
line-height: 1rem;
174+
outline: none;
175+
padding: .35rem .4rem;
176+
vertical-align: middle;
177+
width: 100%;
178+
&:focus {
179+
border-color: #5755d9;
180+
box-shadow: 0 0 0 0.1rem rgba(87, 85, 217, .2)
181+
}
182+
}
183+
184+
.tiny-form-select:not([multiple]):not([size]) {
185+
background: #fff url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns="http://www.w3.org/2000/svg"…path%20fill="%23667189"%20d="M2%200L0%202h4zm0%205L0%203h4z"/%3E%3C/svg%3E') no-repeat right .35rem center/.4rem .5rem;
186+
padding-right: 1.2rem;
187+
}
153188
}
154189
</style>

0 commit comments

Comments
 (0)