ant-design-vue/components/vc-pagination/demo/itemRender.vue

36 lines
711 B
Vue
Raw Normal View History

2018-03-05 11:06:44 +00:00
<script>
2019-01-12 03:33:27 +00:00
import VcPagination from '../index';
import '../assets/index.less';
2018-03-05 11:06:44 +00:00
export default {
2019-09-28 12:45:07 +00:00
data() {
2019-01-12 03:33:27 +00:00
return {};
2018-03-05 11:06:44 +00:00
},
methods: {
2019-09-28 12:45:07 +00:00
itemRender(current, type, element) {
2018-03-05 11:06:44 +00:00
if (type === 'page') {
2019-01-12 03:33:27 +00:00
return <a href={`#${current}`}>{current}</a>;
2018-03-05 11:06:44 +00:00
}
2019-01-12 03:33:27 +00:00
return element;
2018-03-05 11:06:44 +00:00
},
2019-09-28 12:45:07 +00:00
textItemRender(current, type, element) {
2018-03-05 11:06:44 +00:00
if (type === 'prev') {
2019-01-12 03:33:27 +00:00
return 'Prev';
2018-03-05 11:06:44 +00:00
}
if (type === 'next') {
2019-01-12 03:33:27 +00:00
return 'Next';
2018-03-05 11:06:44 +00:00
}
2019-01-12 03:33:27 +00:00
return element;
2018-03-05 11:06:44 +00:00
},
},
2019-09-28 12:45:07 +00:00
render() {
2018-03-05 11:06:44 +00:00
return (
<div>
2019-09-28 12:45:07 +00:00
<VcPagination total={100} itemRender={this.itemRender} />
<VcPagination total={100} itemRender={this.textItemRender} />
2018-03-05 11:06:44 +00:00
</div>
2019-01-12 03:33:27 +00:00
);
2018-03-05 11:06:44 +00:00
},
2019-01-12 03:33:27 +00:00
};
2018-03-05 11:06:44 +00:00
</script>