ant-design-vue/components/pagination/demo/index.vue

85 lines
2.0 KiB
Vue
Raw Normal View History

2017-11-07 03:57:16 +00:00
<template>
<div>
2017-12-20 02:56:21 +00:00
基本
<Pagination current=1 total=50 />
</br>
更多
<Pagination :current="6" total=500 />
</br>
简洁
2017-11-07 03:57:16 +00:00
<div style="margin-bottom:10px">
2017-12-20 02:56:21 +00:00
<pagination :simple="simple" :current="5" :total="total"></pagination>
2017-11-07 03:57:16 +00:00
</div>
2017-12-20 02:56:21 +00:00
</br>
改值操作
2017-11-07 03:57:16 +00:00
<div style="margin-bottom:10px">
2017-11-13 10:49:03 +00:00
<pagination :current="current" :total="total" @change="onchange"></pagination>
2017-11-07 03:57:16 +00:00
<vc-button @click="changeValue"></vc-button>
</div>
2017-12-20 02:56:21 +00:00
</br>
双向绑定
2017-11-07 03:57:16 +00:00
<div>
2017-11-07 06:16:17 +00:00
<pagination v-model="current" :total="total" :showTotal="showTotal"></pagination>
2017-11-07 03:57:16 +00:00
<vc-button @click="getValue"></vc-button>
</div>
2017-12-20 02:56:21 +00:00
</br>
迷你
<Pagination :current="1" total=50 size="small"/>
<Pagination :current="1" total=50 :showTotal="showTotal" size="small"/>
</br>
总数
<Pagination :current="1" total=50 :showTotal="showTotal"/>
<Pagination :current="1" total=50 :showTotal="showTotal1"/>
</br>
跳转
<Pagination v-model="current" total=50 :showQuickJumper="showQuickJumper"/>
<vc-button @click="getValue"></vc-button>
</br>
上一步下一步
<Pagination total=500 :itemRender="itemRender" />
2017-11-07 03:57:16 +00:00
</div>
</template>
<script>
import '../style'
import { Pagination, Button } from 'antd/index'
export default {
data () {
return {
simple: true,
current: 1,
2017-11-07 06:16:17 +00:00
total: 483,
2017-12-20 02:56:21 +00:00
showQuickJumper: true,
2017-11-07 03:57:16 +00:00
}
},
methods: {
changeValue () {
this.current = 4
},
getValue () {
2017-12-20 02:56:21 +00:00
console.log(this.current)
2017-11-07 03:57:16 +00:00
},
2017-11-07 06:16:17 +00:00
showTotal (total) {
2017-12-20 02:56:21 +00:00
return `Total ${total} items`
},
showTotal1 (total, range) {
return `${range[0]}-${range[1]} of ${total} items`
2017-11-07 06:16:17 +00:00
},
2017-11-13 10:49:03 +00:00
onchange (page) {
2017-12-20 02:56:21 +00:00
console.log(page)
},
itemRender (current, type, originalElement) {
if (type === 'prev') {
return <a>Previous</a>
} else if (type === 'next') {
return <a>Next</a>
}
return originalElement
2017-11-13 10:49:03 +00:00
},
2017-11-07 03:57:16 +00:00
},
components: {
Pagination,
vcButton: Button,
},
}
</script>