欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue3中ts語(yǔ)法使用element plus分頁(yè)組件警告錯(cuò)誤問(wèn)題

 更新時(shí)間:2024年04月18日 09:52:17   作者:choorn  
這篇文章主要介紹了vue3中ts語(yǔ)法使用element plus分頁(yè)組件警告錯(cuò)誤問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

vue3 ts語(yǔ)法使用element plus分頁(yè)組件警告錯(cuò)誤

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"                   這一行引發(fā)錯(cuò)誤
    @update:page-size="handleSizeChange" 
    @update:current-page="handleCurrentChange"/>

引起錯(cuò)誤的原因是  :total屬性賦值必須為數(shù)字類型。

修改為如下即可:

:total="parseInt(tableData.totalElements)"

vue Element-ui之el-pagination踩過(guò)的坑

由于頁(yè)面設(shè)計(jì)得彈窗他寬度不夠,還要分成三部分,中間部分是選擇人的分頁(yè),這就很難辦了,把能省的都省了,寬度還是太大,就想著把分頁(yè)跳轉(zhuǎn)的改少一些,設(shè)置可選的跳轉(zhuǎn)為3頁(yè),其余省略號(hào)顯示,我選擇了pager-count,如下:

   <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page.sync="leftPage.currentPage"
        layout="prev, pager, next,sies, jumper"
        :total="10"
        :pagerCount="2"
      ></el-pagination>

雖然頁(yè)面顯示出來(lái)了。。。但是報(bào)錯(cuò)了

  • 頁(yè)面:

  • 報(bào)錯(cuò):

 [Vue warn]: Invalid prop: custom validator check failed for prop "pagerCount".

完了就去查了element的手冊(cè)

意思就是pager-count只能設(shè)置5-21的奇數(shù),無(wú)法實(shí)現(xiàn)只顯示兩個(gè)頁(yè)碼所以我就給設(shè)置了最小值5了,結(jié)果頁(yè)面顯示還可以。 

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論