vue3中ts语法使用element plus分页组件警告错误

main.ts:20 ElementPlusError: [ElPagination] Deprecated usages detected, please refer to the el-pagination documentation for more details
    at debugWarn (error.ts:13:37)
    at Proxy.<anonymous> (pagination.ts:203:9)
    at renderComponentRoot (runtime-core.esm-bundler.js:914:44)
    at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5649:57)
    at ReactiveEffect.run (reactivity.esm-bundler.js:190:25)
    at instance.update (runtime-core.esm-bundler.js:5763:56)
    at setupRenderEffect (runtime-core.esm-bundler.js:5777:9)
    at mountComponent (runtime-core.esm-bundler.js:5559:9)
    at processComponent (runtime-core.esm-bundler.js:5517:17)
    at patch (runtime-core.esm-bundler.js:5119:21)

引起以上警告信息的代码如下:

<el-pagination 
    :current-page="p.page + 1" 
    :page-size="p.pageSize" 
    :page-sizes="[10, 15, 20, 50]"
    background 
    layout="total, sizes, prev, pager, next, jumper"
    :total="tableData.totalElements"                   这一行引发错误
    @update:page-size="handleSizeChange" 
    @update:current-page="handleCurrentChange"/>

引起错误的原因是  :total属性赋值必须为数字类型。修改为如下即可:

:total="parseInt(tableData.totalElements)"

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值