fix: 修复table分页页码bug
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-pagination
|
<el-pagination
|
||||||
small
|
small
|
||||||
|
ref="pagination"
|
||||||
layout="prev,jumper,slot,next"
|
layout="prev,jumper,slot,next"
|
||||||
class="chart-table-pagination"
|
class="chart-table-pagination"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page-size="pageSize"
|
:page-size="pageSize"
|
||||||
|
v-model:currentPage="pageNo"
|
||||||
@current-change="current"
|
@current-change="current"
|
||||||
>
|
>
|
||||||
<span>/ {{totalPage}}</span>
|
<span>/ {{totalPage}}</span>
|
||||||
@@ -20,7 +22,8 @@ export default {
|
|||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
pageSize: chartTableDefaultPageSize
|
pageSize: chartTableDefaultPageSize,
|
||||||
|
pageNo: 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -36,6 +39,10 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
current (val) {
|
current (val) {
|
||||||
this.$emit('pageJump', val)
|
this.$emit('pageJump', val)
|
||||||
|
},
|
||||||
|
resetPageNo () {
|
||||||
|
console.info(11)
|
||||||
|
this.pageNo = 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|||||||
@@ -176,6 +176,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<chart-table-pagination
|
<chart-table-pagination
|
||||||
|
ref="tablePagination"
|
||||||
:total="table.tableData.length"
|
:total="table.tableData.length"
|
||||||
@pageJump="pageJump"
|
@pageJump="pageJump"
|
||||||
></chart-table-pagination>
|
></chart-table-pagination>
|
||||||
@@ -947,6 +948,9 @@ export default {
|
|||||||
this.errorInfo = response.msg || response.message || 'Unknown'
|
this.errorInfo = response.msg || response.message || 'Unknown'
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.tablePagination.resetPageNo()
|
||||||
|
})
|
||||||
setTimeout(() => { this.loading = false }, 250)
|
setTimeout(() => { this.loading = false }, 250)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user