|
@@ -1,8 +1,9 @@
|
|
|
<template>
|
|
|
<div style="position: absolute;bottom: -60px;right: 20px;">
|
|
|
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 20, 30, 40]"
|
|
|
- :small="small" :disabled="disabled" :background="background" layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
|
|
+ :small="small" :disabled="disabled" :background="background"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -31,14 +32,20 @@ export default {
|
|
|
let disabled = ref(false)
|
|
|
let background = ref(false)
|
|
|
let total = ref(100)//总数
|
|
|
- watch(()=>props.totals,(newVal)=>{
|
|
|
+ watch(() => props.totals, (newVal) => {
|
|
|
total.value = newVal
|
|
|
})
|
|
|
+ watch(() => props.pageNum, (newVal) => {
|
|
|
+ currentPage.value = newVal
|
|
|
+ console.log(currentPage.value,'watch');
|
|
|
+ },{
|
|
|
+ deep:true
|
|
|
+ })
|
|
|
function reload() {
|
|
|
currentPage.value = props.pageNum
|
|
|
pageSize.value = props.pageSize
|
|
|
total.value = props.totals
|
|
|
- console.log(total.value,'total');
|
|
|
+ console.log(currentPage.value,'页码');
|
|
|
}
|
|
|
function handleSizeChange(e) {//每页条数
|
|
|
pageSize.value = e
|
|
@@ -47,7 +54,7 @@ export default {
|
|
|
pagesize: pageSize.value - 0
|
|
|
}).then(res => {
|
|
|
total.value = res.count
|
|
|
- emit("pageBack",res.data)
|
|
|
+ emit("pageBack", res.data)
|
|
|
})
|
|
|
}
|
|
|
function handleCurrentChange(e) {//页码
|
|
@@ -57,7 +64,8 @@ export default {
|
|
|
pagesize: pageSize.value - 0
|
|
|
}).then(res => {
|
|
|
total.value = res.count
|
|
|
- emit("pageBack",res.data)
|
|
|
+ emit("currentBack",currentPage.value)
|
|
|
+ emit("pageBack", res.data)
|
|
|
})
|
|
|
}
|
|
|
onMounted(() => {
|