I added some style to the el-pagination and wrapped it up as my own component. However, when I pass the pager-count to it. I got the invalid prop warn by vue.
Here's the code.
<template>
<div :class="lightUI ? 'my-pagination-lightui' : 'my-pagination'">
<el-pagination
small
prev-text="上一页"
next-text="下一页"
:layout="'prev, pager, next' + (hasJumper ? ', jumper' : '')"
:total="Number(total)"
:page-size="pageSize"
:pager-count="pageCount"
/>
</div>
</template>
<script>
export default {
name: 'MyPagination',
props: {
total: String,
pageSize: {
type: Number,
default: 20
},
pageCount: {
type: Number,
default: 5
},
hasJumper: {
type: Boolean,
default: true
},
lightUI: Boolean
}
}
</script>
It's strange that when I use my default pageCount(don't pass pageCount to my own component), there is no warn.
Use it this way, it's totally fine.
<pagination
style="clear: both"
:total="String(comments.total)"
:pageSize="10"
:hasJumper="false"
lightUI
/>
I got this warn only when I'm trying to pass pageCount to my own component like below.
<pagination :total="showing.totalNumber" :page-size="pageSize" :pageCount="8"/>
Hello, this issue has been closed because it does not conform to our issue requirements. Please submit issues with issue-generator. More info can be found in #3693.
I met the same situation. How is this going afterward?
I met the same situation. How is this going afterward?
I just left it there. Though the warn is a little bit annoying, the performance is right.
I met the same situation. How is this going afterward?
I just left it there. Though the warn is a little bit annoying, the performance is right.
怎么去掉这个警告呢,,不明白为什么要限制这个。。
Just found the answer, pagerCount value is limited to odd number.
Just found the answer, pagerCount value is limited to odd number.
文档不是说是5到21吗?3是生效的但是会有警告呢,
Just found the answer, pagerCount value is limited to odd number.
文档不是说是5到21吗?3是生效的但是会有警告呢,
That's why it has a limitation from 5 to 21 odd number.

这有两个值, 一个是page-count 一个是pager-count,希望大家不要弄混了, pager-count是会报错的, 如果值不是5-21, 因为页面的按钮少于5和大于21都不太好看.这是一个正常的取值范围,不是page-count总页数
pager-count - odd number between 5 and 21
the min-value is 5 and max-value is 21.
ex: const stepPager = 5
layout="prev, pager, next"
:pager-count="stepPager"
:total="data.total"
:page-size="pageSizes"
:current-page.sync="currentPage"
@current-change="handleCurrentChange"
/>
the number must be between 5 and 21 ,and the number must be odd ,example:5 7
这有两个值, 一个是page-count 一个是pager-count,希望大家不要弄混了, pager-count是会报错的, 如果值不是5-21, 因为页面的按钮少于5和大于21都不太好看.这是一个正常的取值范围,不是page-count总页数
还要求是奇数
Most helpful comment
That's why it has a limitation from 5 to 21 odd number.