[ElPagination] Deprecated usages detected, please refer to the el-pagination doc

本文介绍了在ElementPlus2.4.4版本中,关于el-pagination组件的四个常见警告,包括关于total参数类型、page-size和current-page事件处理的更新要求。提供了解决这些问题的正确用法示例。
摘要由CSDN通过智能技术生成

调用el-pagination,控制台警告ElementPlusError: [ElPagination] Deprecated usages detected, please refer to the el-pagination documentation for more details

在这里插入图片描述

element plus 版本:2.4.4

1 问题代码1

  <el-pagination
    :page-sizes:="[10, 20, 30, 40]"
    :layout="'total, sizes, prev, pager, next, jumper'"
    :total="total"
  />

以上代码会出现以上警告:
total传参类型为number,实际传了string

2 问题代码2

 <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"
  />

3 问题代码3

 <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"
  />

4 问题代码4

 <el-pagination
    :page-sizes:="[10, 20, 30, 40]"
    :layout="'total, sizes, prev, pager, next, jumper'"
  />

以上代码会出现以上警告:
totalpage-count 必须传一个
正确用法

 <el-pagination
    :page-sizes:="[10, 20, 30, 40]"
    :layout="'total, sizes, prev, pager, next, jumper'"
    :total="total"
  />

element plus 官方解释:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值