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

42 lines
771 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 {
data () {
2019-01-12 03:33:27 +00:00
return {};
2018-03-05 11:06:44 +00:00
},
methods: {
itemRender (current, type, element) {
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
},
textItemRender (current, type, element) {
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
},
},
render () {
return (
<div>
<VcPagination
total={100}
itemRender={this.itemRender}
/>
<VcPagination
total={100}
itemRender={this.textItemRender}
/>
</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>