小明永久免费大陆在线观看-小明永久免费视频-小明永久视频免费播放-小嫩妇好紧好爽再快视频-小嫩嫩12欧美-小日本xxx

首頁 生活 > 正文

Element Plus el-table 自定義合并行和列


(資料圖片僅供參考)

原文鏈接:Element Plus el-table 自定義合并行和列

前言

目標效果是將表格行數據中某個屬性值相同的項合并到一起,效果如下:

                            
import type { TableColumnCtx } from "element-plus"const tableData = [  { "Available": 0, "Capacity": 0, "Name": "test05", "Status": 0, "StoAlias": "test", "Type": 0, "Used": 0 },  { "Available": 0, "Capacity": 0, "Name": "test01", "Status": 0, "StoAlias": "169.254.218", "Type": 0, "Used": 0 },  { "Available": 0, "Capacity": 0, "Name": "tset03", "Status": 0, "StoAlias": "test", "Type": 1, "Used": 0 },  { "Available": 0, "Capacity": 0, "Name": "test02", "Status": 0, "StoAlias": "test03", "Type": 0, "Used": 0 },  { "Available": 0, "Capacity": 0, "Name": "test06", "Status": 0, "StoAlias": "test03", "Type": 0, "Used": 0 },  { "Available": 0, "Capacity": 0, "Name": "test04", "Status": 0, "StoAlias": "169.254.218", "Type": 0, "Used": 0 },  { "Available": 0, "Capacity": 0, "Name": "test07", "Status": 0, "StoAlias": "169.254.218", "Type": 1, "Used": 0 }]let cellList: any[] = [] // 單元格數組let count: number = 0 // 計數const computeCell = (tableList: any[]) => {  cellList = []  count = 0  for (let i = 0; i < tableList.length; i++) {    if (i === 0) {      // 先設置第一項      cellList.push(1); // 初為1,若下一項和此項相同,就往cellList數組中追加0      count = 0; // 初始計數為0    } else {      if (tableList[i].StoAlias == tableList[i - 1].StoAlias) {        cellList[count] += 1; // 增加計數        cellList.push(0); // 相等就往cellList數組中追加0      } else {        cellList.push(1); // 不等就往cellList數組中追加1        count = i; // 將索引賦值為計數      }    }  }}const sortArray = (x: any, y: any) => {  if (x.StoAlias < y.StoAlias) { return -1 }  else if (x.StoAlias > y.StoAlias) { return 1 }  else { return 0 }}interface SpanMethodProps {  row: StoragePoolItem  column: TableColumnCtx  rowIndex: number  columnIndex: number}const spanMethod = ({  rowIndex,  columnIndex,}: SpanMethodProps) => {    computeCell(tableData.sort(sortArray))    if (columnIndex === 0) {      const fRow = cellList[rowIndex]      const fCol = fRow > 0 ? 1 : 0      return {        rowspan: fRow, // 合并的行數        colspan: fCol // 合并的列數,為0表示不顯示      }    }}

sortArray()此方法根據目標屬性值(StoAlias)排序了。

點擊 傳送門 查看更多關于【el-table 合并行或列】的信息。

關鍵詞:

最近更新

關于本站 管理團隊 版權申明 網站地圖 聯系合作 招聘信息

Copyright © 2005-2023 創投網 - m.zhigu.net.cn All rights reserved
聯系我們:39 60 29 14 [email protected]
皖ICP備2022009963號-3

免费国产一级特黄久久 | a级国产乱理伦片在线播放 亚洲成a人片在线观看中文 | 国产福利在线网址成人 | 免费a级毛片高清在钱 | 国产熟睡乱子伦视频观看看 | 国产精品美女久久久 | 国产亚洲欧美在线中文无广告 | 另类视频区第一页 | 久久精品夜色噜噜亚洲a∨ 97人人添人澡人人爽超碰 | 欧美性色欧美a在线播放 | 精品无码国产av一区二区三区 | 久久久久成人网站 | 亚洲日韩亚洲另类激情文学 | 国产伦精品一区二区三区免.费 | 77777_亚洲午夜久久多人 | 丰满人妻在公车被猛烈进入电影 | 999久久66久6只有精品 | 18禁黄污吃奶免费看网站 | 蜜桃av抽搐高潮一区二区 | 极品少妇被猛的白浆直喷白浆 | 亚洲av无码国产精品色午夜 | 人人妻人人澡人人爽久久av | 日本边添边摸边做边爱 | 专干老熟女视频在线观看 | 又大又粗欧美黑人aaaaa片 | 中国女人做爰视频 | 国产精品久久久久久久久久免费 | 无码丰满少妇2在线观看 | 久久国产精品无码网站 | 国产精品爽爽久久久久久竹菊 | 日本老熟妇50岁丰满 | av无码天堂一区二区三区 | 国产精品久久久久国产a级 国产成人av免费观看 | 无套内射无矿码免费看黄 | 91色久| 狂野欧美性猛xxxx乱大交 | www午夜视频 | 国产视频xxxx | 四虎成人精品在永久免费 | 亚洲精品99久久久久中文字幕 | 久久亚洲一级毛片 |