emit current update when page changed
This commit is contained in:
parent
f3c6cd68d1
commit
6355250e52
2 changed files with 8 additions and 1 deletions
|
@ -1,19 +1,25 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<Page :total="total" show-sizer show-elevator show-total></Page>
|
<Page :total="total" show-sizer show-elevator show-total :current.sync="current"></Page>
|
||||||
|
{{ current }}
|
||||||
<Button type="primary" @click="subject">- 1</Button>
|
<Button type="primary" @click="subject">- 1</Button>
|
||||||
|
<Button type="primary" @click="change">Change</Button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
current: 1,
|
||||||
total: 21
|
total: 21
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
subject() {
|
subject() {
|
||||||
this.total -= 1;
|
this.total -= 1;
|
||||||
|
},
|
||||||
|
change() {
|
||||||
|
this.current = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,6 +214,7 @@
|
||||||
changePage (page) {
|
changePage (page) {
|
||||||
if (this.currentPage != page) {
|
if (this.currentPage != page) {
|
||||||
this.currentPage = page;
|
this.currentPage = page;
|
||||||
|
this.$emit('update:current', page);
|
||||||
this.$emit('on-change', page);
|
this.$emit('on-change', page);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue