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

89 lines
2.2 KiB
Vue
Raw Normal View History

2017-11-07 03:57:16 +00:00
<template>
<div>
2017-12-20 02:56:21 +00:00
基本
2018-03-05 11:06:44 +00:00
<Pagination :current="1" :total="50" />
<br>
2017-12-20 02:56:21 +00:00
更多
2018-03-05 11:06:44 +00:00
<Pagination :current="6" :total="500" />
<br>
2017-12-20 02:56:21 +00:00
简洁
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>
2018-03-05 11:06:44 +00:00
<br>
2017-12-20 02:56:21 +00:00
改值操作
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>
2018-03-05 11:06:44 +00:00
<br>
2017-12-20 02:56:21 +00:00
双向绑定
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>
2018-03-05 11:06:44 +00:00
<br>
2017-12-20 02:56:21 +00:00
迷你
2018-03-05 11:06:44 +00:00
<Pagination :current="1" :total="50" size="small"/>
2018-03-06 07:40:42 +00:00
<Pagination :current="1" :total="50" :showTotal="showTotal" size="small" showSizeChanger showQuickJumper/>
2018-03-05 11:06:44 +00:00
<br>
2017-12-20 02:56:21 +00:00
总数
2018-03-05 11:06:44 +00:00
<Pagination :current="1" :total="50" :showTotal="showTotal"/>
<Pagination :current="1" :total="50" :showTotal="showTotal1"/>
<br>
2017-12-20 02:56:21 +00:00
跳转
2018-03-06 07:40:42 +00:00
<Pagination v-model="current" :total="50" :showQuickJumper="showQuickJumper" showSizeChanger>
<template slot='buildOptionText' slot-scope='props'>
<span>{{props.value}}/</span>
</template>
</Pagination>
2017-12-20 02:56:21 +00:00
<vc-button @click="getValue"></vc-button>
2018-03-05 11:06:44 +00:00
<br>
2017-12-20 02:56:21 +00:00
上一步下一步
2018-03-05 11:06:44 +00:00
<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>