Commit 3f708ac9 authored by 赵茹林's avatar 赵茹林

分页组件 修复 多弹窗公用时分页不能重置的问题

parent 01bbbb24
......@@ -2,10 +2,11 @@
<div class="page-div">
<el-pagination
:small="small"
@size-change="handleSizeChange"
:page-sizes="[5, 10, 20, 30, 40, 50, 60, 80, 100]"
:page-size="limit"
:current-page.sync="nowPage"
:page-sizes="[5, 10, 20, 30, 40, 50, 60, 80, 100]"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="nowPage"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
......@@ -21,6 +22,9 @@
}
},
props: {
'currentPage': {
required: false,
},
'total': {
required: true
},
......@@ -28,19 +32,29 @@
default: 10
},
'small': {
required: false,
type: Boolean,
default: false
}
},
watch: {
nowPage(value) {
this.$emit("pageChange", value);
}
currentPage(val) { // 改变这个值并不会触发 handleCurrentChange
if (typeof val === "number") {
console.log('prop currentPage!!!');
this.nowPage = val;
}
},
},
methods: {
// 当前页变化
handleCurrentChange(val) {
console.log('methods pageChange!!!')
this.$emit("pageChange", val);
},
// size变化
handleSizeChange(val) {
this.nowPage = 1;
this.$emit('sizeChange', val);
this.nowPage = 1
},
}
}
......
......@@ -129,8 +129,9 @@
</el-table>
<!--业绩 结束-->
<!--todo 分页有问题-->
<page v-if="total" :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/>
<!--todo 分页有问题 权限有问题-->
<!--<page v-if="total" :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/>-->
<page :current-page="nowPage" :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/>
</div>
</el-dialog>
......@@ -148,8 +149,7 @@
dialogObj: {
type: Object,
required: true,
default: () => {
}
default: () => {}
}
},
data() {
......@@ -168,7 +168,7 @@
},
methods: {
initDialog() {
console.log(this.dialogObj)
// console.log(this.dialogObj)
if (this.dialogObj) {
this.show = this.dialogObj.show;
this.getData();
......@@ -293,7 +293,7 @@
deep: true
},
show(value) {
// this.nowPage = 1;
this.nowPage = 1; // 重置
this.$emit("changeShow", value);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment