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

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

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