Skip to content

Commit

Permalink
feat: add custom prev and next text
Browse files Browse the repository at this point in the history
  • Loading branch information
a46156060 committed Jan 27, 2019
1 parent ec08f30 commit f9352c6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
9 changes: 9 additions & 0 deletions examples/code/components/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,13 @@ code.sizes = `\
<vb-pagination :pageCount="5" size="large"></vb-pagination>
`

code.customText = `\
<vb-pagination :pageCount="5" prev-text="上一页" next-text="下一页"></vb-pagination>
<vb-pagination :pageCount="5">
<vb-icon slot="prev" name="fa fa-chevron-left"></vb-icon>
<vb-icon slot="next" name="fa fa-chevron-right"></vb-icon>
</vb-pagination>
`

export default code
11 changes: 11 additions & 0 deletions examples/components/components/Pagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@
<vb-pagination :pageCount="5" size="large"></vb-pagination>
</demo>
</example-section-item>

<example-section-item title="Custom text">
<demo :code="code.customText">
<vb-pagination :pageCount="5" prev-text="上一页" next-text="下一页"></vb-pagination>

<vb-pagination :pageCount="5">
<vb-icon slot="prev" name="fa fa-chevron-left"></vb-icon>
<vb-icon slot="next" name="fa fa-chevron-right"></vb-icon>
</vb-pagination>
</demo>
</example-section-item>
</vb-section>
</template>

Expand Down
12 changes: 9 additions & 3 deletions src/components/components/Pagination.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<template>
<nav role="navigation" aria-label="pagination" :class="classes">
<a class="pagination-previous" :disabled="!hasPrevPage" @click="prePage">
上一页
<slot name="prev">
{{ prevText || 'Previous' }}
</slot>
</a>

<a class="pagination-next" :disabled="!hasNextPage" @click="nextPage">
下一页
<slot name="next">
{{ nextText || 'Next page' }}
</slot>
</a>

<ul class="pagination-list">
Expand Down Expand Up @@ -74,7 +78,9 @@ export default {
type: Number,
default: 5
},
rounded: Boolean
rounded: Boolean,
prevText: String,
nextText: String
},
data() {
return {
Expand Down

1 comment on commit f9352c6

@vercel
Copy link

@vercel vercel bot commented on f9352c6 Jan 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully aliased the URL https://bulma-ui-46rs49pah.now.sh to the following alias.

Please sign in to comment.