vue3关于elementuiPlus表头合并问题?

数据:

export const tableData = {
  "data": [
    {
      "ctype": "海淀",
      "clist": [
        {
          "companyName": "公司1",
          "ydata": [
            {
              "year": "2021",
              "hte": "1",
              "tb": "2",
              "ctype": null,
              "companyName": null
            },
            {
              "year": "2022",
              "hte": "3",
              "tb": "4",
              "ctype": null,
              "companyName": null
            },
            {
              "year": "2023",
              "hte": "5",
              "tb": "6",
              "ctype": null,
              "companyName": null
            },
          ]
        },
        {
          "companyName": "公司2",
          "ydata": [
            {
              "year": "2021",
              "hte": "00",
              "tb": "68",
              "ctype": null,
              "companyName": null
            },
            {
              "year": "2022",
              "hte": "50",
              "tb": "49",
              "ctype": null,
              "companyName": null
            },
            {
              "year": "2023",
              "hte": "56",
              "tb": "69",
              "ctype": null,
              "companyName": null
            },
          ]
        }
      ]
    },

    {
      "ctype": "朝阳",
      "clist": [
        {
          "companyName": "阿里巴巴",
          "ydata": [
            {
              "year": "2021",
              "hte": "50",
              "tb": "-95",
              "ctype": null,
              "companyName": null
            },
            {
              "year": "2022",
              "hte": "50",
              "tb": "-93.6",
              "ctype": null,
              "companyName": null
            },
            {
              "year": "2023",
              "hte": "579",
              "tb": "-90",
              "ctype": null,
              "companyName": null
            },
          ]
        }
      ]
    },
    {
      "ctype": "其他",
      "clist": [
        {
          "companyName": "京东",
          "ydata": [
            {
              "year": "2021",
              "hte": "11",
              "tb": "2331",
              "ctype": null,
              "companyName": null
            },
            {
              "year": "2022",
              "hte": "102",
              "tb": "1682",
              "ctype": null,
              "companyName": null
            },
            {
              "year": "2023",
              "hte": "103",
              "tb": "2993",
              "ctype": null,
              "companyName": null
            },
          ]
        },
        {
          "companyName": "谷歌",
          "ydata": [
            {
              "year": "2021",
              "hte": "88",
              "tb": "-76",
              "ctype": null,
              "companyName": null
            },
            {
              "year": "2022",
              "hte": "880",
              "tb": null,
              "ctype": null,
              "companyName": null
            },
            {
              "year": "2023",
              "hte": "8835",
              "tb": "1092",
              "ctype": null,
              "companyName": null
            },
          ]
        },
      ]
    },
  ]
}

效果:
image.png

不知道我描述清楚了没?
如果我没有说清楚的话麻烦看下这个例子,我应该怎么处理表格的数据
https://element-plus.run/#eyJzcmMvQXBwLnZ1ZSI6Ijx0ZW1wbGF0ZT5...

阅读 2.2k
2 个回答

占个坑,有空了我把代码贴上去,自己回答吧,供其他人参考

推荐问题
logo
Microsoft
子站问答
访问
宣传栏