Open moonlik opened 7 years ago
/
keeped for backward compatibility and there a #normalize()
which remove duplicated slashes. If you are using a custom #urlBuilder()
you can do what you want.
@korzhyk but in my use case I need to put the page number not after slash, but after ?page=
. So the string ?page=
is my prefix. And it doesn't need any additional slashes.
<pagination v-bind:urlPrefix="'?page='"
v-bind:currentPage="parseInt(query.page)"
v-bind:lastPage="lastPage"
v-bind:displayPage="5"
class="is-small" />
But slash is hardcoded here. It's a very unflexible solution.
I propose another way:
urlPrefix
is a prefix which can include any characters. If somebody needs to add slash let him put this slash directly in his prefix (for example, urlPrefix='page/'
), which won't affect others who have another URL formats (for example, urlPrefix='?page='
).
https://github.com/vue-bulma/pagination/blob/58a57f1fbee596881cd8e3d859ae34386c7f1005/src/Pagination.vue#L3
So, I faced with this problem before contribute #urlBuilder()
too. And as you can see urlBuilder
resolve this issue as well.
<pagination v-bind:urlBuilder="page => ({ query: { page } })"
v-bind:currentPage="parseInt(query.page)"
v-bind:lastPage="lastPage"
v-bind:displayPage="5"
class="is-small" />
ℹ️ Hardcoded slash placed for backward compatibility.
@korzhyk Oh, I see. Thank you for your help! Everything is working now.
I don't know why but you still keep to hard code the slash in your code. And I think the slash in the code below is not needed because you can input the slash in urlPrefix.
Why do you want to keep this slash between
${this.urlPrefix}
and${page}
?