Commit 4935594e4e234fd3494e746550400d7535f0d6ac
1 parent
93efaba8
fixed #21
fixed #21
Showing
3 changed files
with
9 additions
and
6 deletions
Show diff stats
components/page/page.vue
@@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
41 | <li :title="current + 1" v-if="current + 1 < allPages" :class="[`${prefixCls}-item`]" @click="changePage(current + 1)"><a>{{ current + 1 }}</a></li> | 41 | <li :title="current + 1" v-if="current + 1 < allPages" :class="[`${prefixCls}-item`]" @click="changePage(current + 1)"><a>{{ current + 1 }}</a></li> |
42 | <li :title="current + 2" v-if="current + 2 < allPages" :class="[`${prefixCls}-item`]" @click="changePage(current + 2)"><a>{{ current + 2 }}</a></li> | 42 | <li :title="current + 2" v-if="current + 2 < allPages" :class="[`${prefixCls}-item`]" @click="changePage(current + 2)"><a>{{ current + 2 }}</a></li> |
43 | <li title="向后 5 页" v-if="current + 3 < allPages" :class="[`${prefixCls}-item-jump-next`]" @click="fastNext"><a><i class="ivu-icon ivu-icon-ios-arrow-right"></i></a></li> | 43 | <li title="向后 5 页" v-if="current + 3 < allPages" :class="[`${prefixCls}-item-jump-next`]" @click="fastNext"><a><i class="ivu-icon ivu-icon-ios-arrow-right"></i></a></li> |
44 | - <li :title="'最后一页:' + allPages" :class="[`${prefixCls}-item`, {[`${prefixCls}-item-active`]: current == allPages}]" @click="changePage(allPages)"><a>{{ allPages }}</a></li> | 44 | + <li :title="'最后一页:' + allPages" v-if="allPages > 1" :class="[`${prefixCls}-item`, {[`${prefixCls}-item-active`]: current == allPages}]" @click="changePage(allPages)"><a>{{ allPages }}</a></li> |
45 | <li | 45 | <li |
46 | title="下一页" | 46 | title="下一页" |
47 | :class="nextClasses" | 47 | :class="nextClasses" |
@@ -117,7 +117,8 @@ | @@ -117,7 +117,8 @@ | ||
117 | }, | 117 | }, |
118 | computed: { | 118 | computed: { |
119 | allPages () { | 119 | allPages () { |
120 | - return Math.ceil(this.total / this.pageSize); | 120 | + const allPage = Math.ceil(this.total / this.pageSize); |
121 | + return (allPage === 0) ? 1 : allPage; | ||
121 | }, | 122 | }, |
122 | simpleWrapClasses () { | 123 | simpleWrapClasses () { |
123 | return [ | 124 | return [ |
local/routers/index.vue
@@ -7,13 +7,15 @@ | @@ -7,13 +7,15 @@ | ||
7 | <Button @click="warning">warning</Button> | 7 | <Button @click="warning">warning</Button> |
8 | <Button @click="error">error</Button> | 8 | <Button @click="error">error</Button> |
9 | <Button @click="confirm">confirm</Button> | 9 | <Button @click="confirm">confirm</Button> |
10 | - | 10 | + <Page :total="11" :page-size="11"></Page> |
11 | + <Page :total="11" size="small"></Page> | ||
12 | + <Page :current="1" :total="0" simple></Page> | ||
11 | </template> | 13 | </template> |
12 | <script> | 14 | <script> |
13 | - import { Modal, Button, Message } from 'iview'; | 15 | + import { Modal, Button, Message, Page } from 'iview'; |
14 | 16 | ||
15 | export default { | 17 | export default { |
16 | - components: { Modal, Button }, | 18 | + components: { Modal, Button, Page }, |
17 | props: { | 19 | props: { |
18 | 20 | ||
19 | }, | 21 | }, |
package.json
1 | { | 1 | { |
2 | "name": "iview", | 2 | "name": "iview", |
3 | - "version": "0.9.2", | 3 | + "version": "0.9.3", |
4 | "title": "iView", | 4 | "title": "iView", |
5 | "description": "A high quality UI components Library with Vue.js", | 5 | "description": "A high quality UI components Library with Vue.js", |
6 | "homepage": "http://www.iviewui.com", | 6 | "homepage": "http://www.iviewui.com", |