调用el-pagination,控制台警告ElementPlusError: [ElPagination] Deprecated usages detected, please refer to the el-pagination documentation for more details
element plus 版本:2.4.4
<el-pagination
:page-sizes:="[10, 20, 30, 40]"
:layout="'total, sizes, prev, pager, next, jumper'"
:total="total"
/>
以上代码会出现以上警告:
total传参类型为number,实际传了string
<el-pagination
:page-size='size'
:page-sizes:="[10, 20, 30, 40]"
:layout="'total, sizes, prev, pager, next, jumper'"
:total="1"
/>
以上代码会出现以上警告:
传入了page-size,但是没有监听page-size变更的事件(@update:page-size
)
正确用法:
<el-pagination
:page-size='size'
@update:page-size='handlePageSize'
:page-sizes:="[10, 20, 30, 40]"
:layout="'total, sizes, prev, pager, next, jumper'"
:total="1"
/>
<el-pagination
v-model:page-size='size'
:page-sizes:="[10, 20, 30, 40]"
:layout="'total, sizes, prev, pager, next, jumper'"
:total="1"
/>
<el-pagination
:current-page='currentPage'
:page-sizes:="[10, 20, 30, 40]"
:layout="'total, sizes, prev, pager, next, jumper'"
:total="1"
/>
以上代码会出现以上警告:
传入了current-page,但是没有监听current-page变更的事件(@update:current-page
)
正确用法:
<el-pagination
:current-page='currentPage'
@update:current-page='handleCurrentPage'
:page-sizes:="[10, 20, 30, 40]"
:layout="'total, sizes, prev, pager, next, jumper'"
:total="1"
/>
<el-pagination
v-model:current-page='currentPage'
:page-sizes:="[10, 20, 30, 40]"
:layout="'total, sizes, prev, pager, next, jumper'"
:total="1"
/>
<el-pagination
:page-sizes:="[10, 20, 30, 40]"
:layout="'total, sizes, prev, pager, next, jumper'"
/>
以上代码会出现以上警告:
total
和 page-count
必须传一个
正确用法:
<el-pagination
:page-sizes:="[10, 20, 30, 40]"
:layout="'total, sizes, prev, pager, next, jumper'"
:total="total"
/>