本文主要是介绍ElementPlusError: [ElPagination] undefined,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
报错原因:必传值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];// console.log(`原值为${oldValue}`) // console.log(`新值为${newValue}`) })return {...toRefs(pageInfo),}
}
这篇关于ElementPlusError: [ElPagination] undefined的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!