vue + element-ui动态生成多级表头的方法

  vue +元素

<强>

  

        & lt; div id=氨怼痹趝{tableData}}   & lt; el-table:数据=" https://www.yisu.com/zixun/tabledata01 ":广度法=皌ableSpanMethod max-height=" 420 "比;   & lt; el-table-column v=皌ableConfig项”:标签="项目。标签”:支持='项目。道具:宽度=项目。宽度”:关键=癷tem.id”比;   & lt; el-table-column v=' item.children | | item.children.length> 0 ' v=癷tem.children item1”   :label=" item1。标签”:=' item1提案。道具:宽度=item1。宽度”:关键=癷tem1.id”比;   & lt; el-table-column v=' item1.children | | item1.children.length> 0 ' v=癷tem1.children第二条”   :label="第二条。标签”:支持='第二条。道具:宽度=第二条。宽度”:关键=癷tem2.id”比;   & lt;/el-table-column>   & lt;/el-table-column>   & lt;/el-table-column>   & lt;/el-table>   & lt;/div>      

        tableConfig:(   {id: 100,标签:“一级表头”,道具:“宽度:“孩子:[   {id: 110,标签:“二级表头1 ',道具:districtName,宽度:"},   {id: 120,标签:“二级表头2》,道具:timeDimension,宽度:"}   )},   {id: 200,标签:“一级表头”,道具:“宽度:“孩子:[   {id: 210,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 211,标签:“三级表头”,道具:residentPopNum,宽度:' 110 '},   {id: 212,标签:“三级表头”,道具:residentPopDst,宽度:' 110 '}   ]}   )},   {id: 300,标签:“一级表头”,道具:“宽度:“孩子:[   {id: 310,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 311,标签:“三级表头”,道具:liveLandArea,宽度:' 110 '},   {id: 312,标签:“三级表头”,道具:liveLandDst,宽度:' 110 '}   ],   },   {id: 320,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 321,标签:“三级表头(公里;)”,道具:employmentLandArea,宽度:' 110 '},   {id: 322,标签:“三级表头”,道具:employmentLandDst,宽度:' 110 '}   ],   }   )},   {id: 400,标签:“一级表头”,道具:“宽度:“孩子:[   {id: 410,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 411,标签:“三级表头(个)”,道具:regionTrafficHubNum,宽度:' 110 '},   {id: 412,标签:“三级表头(人次/公里;)”,道具:regionTrafficHubFlow,宽度:' 140 '}   ],   },   {id: 420,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 421,标签:“三级表头(个)”,道具:highSpeedNum,宽度:' 110 '},   {id: 422,标签:“三级表头(个/公里;)”,道具:highSpeedDst,宽度:' 140 '}   ],   },{id: 430,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 431,标签:“三级表头(个)”,道具:trackTrafficSpotNum,宽度:' 140 '},   {id: 432,标签:“三级表头(个/公里;)”,道具:trackTrafficSpotDst,宽度:' 140 '}   ],   },   {id: 440,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 441,标签:“三级表头(公里),道具:trackTrafficNetNum,宽度:' 110 '},   {id: 442,标签:“三级表头(公里/公里;)”,道具:trackTrafficNetDst,宽度:' 140 '}   ],   },   {id: 450,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 451,标签:“三级表头(个)”,道具:cityTrafficHubNum,宽度:' 110 '},   {id: 452,标签:“三级表头(个/公里;)”,道具:cityTrafficHubDst,宽度:' 110 '},   {id: 453,标签:“三级表头(人次/公里;)”,道具:cityTrafficHubFlow,宽度:' 140 '}   ],   },   {id: 460,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 461,标签:“三级表头(公里),道具:cityTrafficNetNum,宽度:' 110 '},   {id: 462,标签:“三级表头”,道具:cityTrafficNetDst,宽度:' 140 '}   ],   },   )},   {id: 500,标签:“一级表头”,道具:“宽度:“孩子:[   {id: 510,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 511,标签:“三级表头(公里;)”,道具:pubServeLandArea,宽度:' 110 '},   {id: 512,标签:“三级表头”,道具:pubServeLandDst,宽度:' 110 '}   ],   },   {id: 520,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 521,标签:“三级表头(个)”,道具:hospitalResourcesNum,宽度:' 110 '},   {id: 522,标签:“三级表头(公里;)”,道具:hospitalResourcesArea,宽度:' 110 '},   {id: 523,标签:“三级表头(个/公里;)”,道具:hospitalResourcesDst,宽度:' 110 '}   ],   },{id: 530,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 531,标签:“三级表头(个)”,道具:schoolResourcesNum,宽度:' 110 '},   {id: 532,标签:“三级表头(公里;)”,道具:schoolResourcesArea,宽度:' 110 '},   {id: 533,标签:“三级表头(个/公里;)”,道具:schoolResourcesDst,宽度:' 110 '}   ],   },   {id: 540,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 541,标签:“三级表头(个)”,道具:humanResourcesNum,宽度:' 110 '},   {id: 542,标签:“三级表头(个/公里;)”,道具:humanResourcesDst,宽度:' 110 '}   ],   },   {id: 550,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 551,标签:“三级表头(个)”,道具:businessResourcesNum,宽度:' 110 '},   {id: 552,标签:“三级表头(个/公里;)”,道具:businessResourcesDst,宽度:' 110 '}   ],   },   {id: 560,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 561,标签:“三级表头(个)”,道具:environResourcesNum,宽度:' 110 '},   {id: 562,标签:“三级表头(个/公里;)”,道具:environResourcesDst,宽度:' 110 '}   ],   },   )},   {id: 600,标签:“一级表头”,道具:“宽度:“孩子:[   {id: 610,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 611,标签:“三级表头(分),道具:populationScore,宽度:' 110 '},   ],   },   {id: 620,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 621,标签:“三级表头(分),道具:landScore,宽度:' 110 '},   ],   },{id: 630,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 631,标签:“三级表头(分),道具:trafficScore,宽度:' 110 '},   ],   },   {id: 640,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 641,标签:“三级表头(分),道具:communalFacilitiesScore,宽度:' 110 '},   ],   },   {id: 650,标签:“二级表头”,道具:“宽度:“孩子:[   {id: 651,标签:“三级表头(分),道具:modelScore,宽度:' 110 '},   ],   }   )},   ),

vue + element-ui动态生成多级表头的方法