vue3中ts语法使用element plus分页组件警告错误
引起错误的原因是:total属性赋值必须为数字类型。
·
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)"
更多推荐
已为社区贡献2条内容
所有评论(0)