emit current update when page changed

This commit is contained in:
Rijn 2017-08-10 11:28:44 -05:00
parent f3c6cd68d1
commit 6355250e52
2 changed files with 8 additions and 1 deletions

View file

@ -1,19 +1,25 @@
<template>
<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="change">Change</Button>
</div>
</template>
<script>
export default {
data () {
return {
current: 1,
total: 21
}
},
methods: {
subject() {
this.total -= 1;
},
change() {
this.current = 1;
}
}
}

View file

@ -214,6 +214,7 @@
changePage (page) {
if (this.currentPage != page) {
this.currentPage = page;
this.$emit('update:current', page);
this.$emit('on-change', page);
}
},