|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="page-wrap" v-if="total/1.0/pageSize>1">
|
|
<div class="page-wrap" v-if="total/1.0/pageSize>1">
|
|
|
<el-pagination
|
|
<el-pagination
|
|
|
|
|
+ :current-page.sync="currentPage"
|
|
|
:page-size="pageSize"
|
|
:page-size="pageSize"
|
|
|
layout="prev, pager, next"
|
|
layout="prev, pager, next"
|
|
|
:total="total"
|
|
:total="total"
|
|
@@ -9,7 +10,7 @@
|
|
|
</el-pagination>
|
|
</el-pagination>
|
|
|
<ul class="pagination" style="float:right;margin-left:20px;">
|
|
<ul class="pagination" style="float:right;margin-left:20px;">
|
|
|
<li>
|
|
<li>
|
|
|
- <input type="text" class="page-number" v-model="nowPage">
|
|
|
|
|
|
|
+ <input type="number" class="page-number" @keyup.13="changePage" v-model="nowPage">
|
|
|
</li>
|
|
</li>
|
|
|
<li>
|
|
<li>
|
|
|
<a class="page-a" @click="changePage">GO</a>
|
|
<a class="page-a" @click="changePage">GO</a>
|
|
@@ -22,20 +23,30 @@
|
|
|
export default {
|
|
export default {
|
|
|
data () {
|
|
data () {
|
|
|
return {
|
|
return {
|
|
|
- nowPage: 1
|
|
|
|
|
|
|
+ nowPage: 1,
|
|
|
|
|
+ currentPage: 1
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
current: function () {
|
|
current: function () {
|
|
|
- this.nowPage = this.current
|
|
|
|
|
|
|
+ this.nowPage = Number(this.current)
|
|
|
|
|
+ this.currentPage = this.nowPage
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
props: ['current', 'total', 'pageSize'],
|
|
props: ['current', 'total', 'pageSize'],
|
|
|
methods: {
|
|
methods: {
|
|
|
handleCurrentChange: function (changedPage) {
|
|
handleCurrentChange: function (changedPage) {
|
|
|
- this.$emit('childEvent', changedPage)
|
|
|
|
|
|
|
+ if (this.nowPage !== this.currentPage) {
|
|
|
|
|
+ this.$emit('childEvent', changedPage)
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
changePage: function () {
|
|
changePage: function () {
|
|
|
|
|
+ let totalPage = Math.ceil(this.total / this.pageSize)
|
|
|
|
|
+ if (this.nowPage > totalPage) {
|
|
|
|
|
+ this.nowPage = totalPage
|
|
|
|
|
+ } else if (this.nowPage < 1) {
|
|
|
|
|
+ this.nowPage = 1
|
|
|
|
|
+ }
|
|
|
this.$emit('childEvent', this.nowPage)
|
|
this.$emit('childEvent', this.nowPage)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -149,4 +160,12 @@
|
|
|
display: inline-block;
|
|
display: inline-block;
|
|
|
margin: 0;
|
|
margin: 0;
|
|
|
}
|
|
}
|
|
|
|
|
+ input.page-number {
|
|
|
|
|
+ -moz-appearance:textfield;
|
|
|
|
|
+ }
|
|
|
|
|
+ input.page-number::-webkit-inner-spin-button,
|
|
|
|
|
+ input.page-number::-webkit-outer-spin-button {
|
|
|
|
|
+ -webkit-appearance: none;
|
|
|
|
|
+ margin: 0;
|
|
|
|
|
+ }
|
|
|
</style>
|
|
</style>
|