![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/d5bfb6a9ef2d09f3e6131ddfcb9b1cbb.png)
报错原因:必传值total最初传入的值为undefined
解决:使用watch进行监听赋值
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
v-model:current-page="index"
v-model:page-size="size"
:page-sizes="pageSizes"
layout="total, sizes, prev, pager, next"
:total="totalNum"
:background="true">
</el-pagination>
setup(props, context) {
const pageInfo = reactive({
index:1,
size: 10,
totalNum:0
})
watch(
() => [props.pagemeta.page, props.pagemeta.page_size, props.pagemeta.total] ,
(newValue, oldValue) => {
pageInfo.index = newValue[0];
pageInfo.size = newValue[1];
pageInfo.totalNum = newValue[2];
})
return {
...toRefs(pageInfo),
}
}