commit
b60bb38e15
@ -3,7 +3,7 @@
|
||||
<div
|
||||
v-for="(item, index) in data"
|
||||
:key="index"
|
||||
v-show="((index + 1) > (currentPage - 1) * 10) && ((index + 1) <= currentPage * 10)"
|
||||
v-if="((index + 1) > (currentPage - 1) * 10) && ((index + 1) <= currentPage * 10)"
|
||||
class="abstract-item">
|
||||
<div class="title">
|
||||
<router-link
|
||||
|
@ -1,14 +1,13 @@
|
||||
<template>
|
||||
<div class="pagation" v-show="show">
|
||||
<div class="pagation-list">
|
||||
<span class="jump" v-show="currentPage>1" @click="goPrev">上一页</span>
|
||||
<span v-show="currentPage>5" class="jump" @click="jumpPage(1)">1</span>
|
||||
<span class="jump" v-show="currentPage>1" @click="goPrev" unselectable="on">上一页</span>
|
||||
<span v-show="efont" class="jump" @click="jumpPage(1)">1</span>
|
||||
<span class="ellipsis" v-show="efont">...</span>
|
||||
<span class="jump" v-for="num in indexs" :key="num" :class="{bgprimary:currentPage==num}" @click="jumpPage(num)">{{num}}</span>
|
||||
<span class="ellipsis" v-show="efont&¤tPage<pages-4">...</span>
|
||||
|
||||
<span v-show="efont&¤tPage<pages-4" class="jump" @click="jumpPage(pages)">{{pages}}</span>
|
||||
<span class="jump" v-show="currentPage < pages" @click="goNext">下一页</span>
|
||||
|
||||
<span class="jumppoint">跳转到:</span>
|
||||
<span class="jumpinp"><input type="text" v-model="changePage"></span>
|
||||
<span class="jump gobtn" @click="jumpPage(changePage)">GO</span>
|
||||
@ -78,18 +77,22 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
goPrev () {
|
||||
let currentPage = this.currentPage
|
||||
if (this.currentPage > 1) {
|
||||
const currentPage = this.currentPage
|
||||
this.emit(currentPage--)
|
||||
this.emit(--currentPage)
|
||||
}
|
||||
},
|
||||
goNext () {
|
||||
if (this.currentPage < this.pages) {
|
||||
const currentPage = this.currentPage
|
||||
this.emit(currentPage++)
|
||||
let currentPage = this.currentPage
|
||||
if (currentPage < this.pages) {
|
||||
this.emit(++currentPage)
|
||||
}
|
||||
},
|
||||
jumpPage: function(id) {
|
||||
if(id == ''){
|
||||
alert(`请输入页码!`)
|
||||
return
|
||||
}
|
||||
if (id <= this.pages) {
|
||||
this.emit(id)
|
||||
return
|
||||
@ -107,7 +110,7 @@ export default {
|
||||
@import '../../styles/config.styl'
|
||||
|
||||
.pagation
|
||||
font-weight: 900;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
color: #888;
|
||||
margin: 20px auto 0;
|
||||
@ -116,6 +119,12 @@ export default {
|
||||
font-size: 0;
|
||||
background: #fff;
|
||||
line-height: 50px;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
span
|
||||
font-size: 14px;
|
||||
&.jump
|
||||
@ -146,4 +155,4 @@ export default {
|
||||
padding: 0px 8px;
|
||||
&.jumppoint
|
||||
margin-left: 30px;
|
||||
</style>
|
||||
</style>
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
<pagation
|
||||
:data="pages"
|
||||
:currentPage="currentPage"
|
||||
@getCurrentPage="getCurrentPage"></pagation>
|
||||
</div>
|
||||
</template>
|
||||
@ -78,6 +79,7 @@ export default {
|
||||
})
|
||||
// reverse()是为了按时间最近排序排序
|
||||
this.pages = pages.length == 0 ? [] : pages.reverse()
|
||||
this.getCurrentPage(1);
|
||||
},
|
||||
getCurrentPage (page) {
|
||||
this.currentPage = page
|
||||
|
@ -38,4 +38,4 @@ export default {
|
||||
margin: 0 auto;
|
||||
padding: 0 2.5rem;
|
||||
background-color #fff
|
||||
</style>
|
||||
</style>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vuepress-theme-reco",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "this is a vuepress theme",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
Loading…
Reference in New Issue
Block a user