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

el-table樹形數(shù)據(jù)序號排序處理方案

 更新時間:2024年03月19日 11:19:22   作者:Cool_so_cool  
這篇文章主要介紹了el-table樹形數(shù)據(jù)序號排序處理方案,本文通過實例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下

1,用下面這個代碼可以實現(xiàn)基本表格的序號排序

 <el-table-column label="序號" width="50px" align="center">
        <template slot-scope="scope">
                {{ scope.$index + 1 }}
         </template>
  </el-table-column>

2,element ui樹形結(jié)構(gòu)的表格,是沒有序號排序的,如果還是用上面的代碼,序號排序的時候也會把數(shù)據(jù)的子節(jié)點進行序號排序

上面那個肯定不是我們想要的效果,直接上代碼,看最終效果

 this.tableData1.forEach((item, index) => {
      item.parentIndex = index + 1;
      if (item.children) {
        item.children.forEach((it, ind) => {
          it.parentIndex = item.parentIndex + "-" + (ind + 1)
        })
      }
    })

展開前

展開后

到此這篇關(guān)于el-table樹形數(shù)據(jù)序號排序處理的文章就介紹到這了,更多相關(guān)el-table樹形數(shù)據(jù)內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論