Commit 6355250e52b0f128115ebe221c02fb22df1c3925

Authored by Rijn
1 parent f3c6cd68

emit current update when page changed

Showing 2 changed files with 8 additions and 1 deletions   Show diff stats
examples/routers/page.vue
1 1 <template>
2 2 <div>
3   - <Page :total="total" show-sizer show-elevator show-total></Page>
  3 + <Page :total="total" show-sizer show-elevator show-total :current.sync="current"></Page>
  4 + {{ current }}
4 5 <Button type="primary" @click="subject">- 1</Button>
  6 + <Button type="primary" @click="change">Change</Button>
5 7 </div>
6 8 </template>
7 9 <script>
8 10 export default {
9 11 data () {
10 12 return {
  13 + current: 1,
11 14 total: 21
12 15 }
13 16 },
14 17 methods: {
15 18 subject() {
16 19 this.total -= 1;
  20 + },
  21 + change() {
  22 + this.current = 1;
17 23 }
18 24 }
19 25 }
... ...
src/components/page/page.vue
... ... @@ -214,6 +214,7 @@
214 214 changePage (page) {
215 215 if (this.currentPage != page) {
216 216 this.currentPage = page;
  217 + this.$emit('update:current', page);
217 218 this.$emit('on-change', page);
218 219 }
219 220 },
... ...