vxe-table 使用分组表头列头


 


1.x ~ 2.x 版本使用 <vxe-column…> | <vxe-table-column…> 标签递归方式

<vxe-table :data="tableData" show-overflow>
  <vxe-column title="基本信息">
    <vxe-column type="seq" width="60"></vxe-column>
    <vxe-column field="name" title="Name"></vxe-column>
  </vxe-column>
  <vxe-column title="更多信息">
    <vxe-column field="role" title="Role"></vxe-column>
    <vxe-column title="详细信息">
      <vxe-column field="sex" title="Sex"></vxe-column>
      <vxe-column field="age" title="Age"></vxe-column>
    </vxe-column>
  </vxe-column>
  <vxe-column title="分类信息">
    <vxe-column field="date3" title="Date"></vxe-column>
  </vxe-column>
  <vxe-column field="address" title="Address"></vxe-column>
</vxe-table>

 

2.9.24 ~ 3.x 同时支持两种方式,为 4.x 过度

  3.x ~ 4.x 版本使用 <vxe-colgroup…> | <vxe-table-colgroup…> 分组标签

<vxe-table :data="tableData" show-overflow>
  <vxe-colgroup title="基本信息">
    <vxe-column type="seq" width="60"></vxe-column>
    <vxe-column field="name" title="Name"></vxe-column>
  </vxe-colgroup>
  <vxe-colgroup title="更多信息">
    <vxe-column field="role" title="Role"></vxe-column>
    <vxe-colgroup title="详细信息">
      <vxe-column field="sex" title="Sex"></vxe-column>
      <vxe-column field="age" title="Age"></vxe-column>
    </vxe-colgroup>
  </vxe-colgroup>
  <vxe-colgroup title="分类信息">
    <vxe-column field="date3" title="Date"></vxe-column>
  </vxe-colgroup>
  <vxe-column field="address" title="Address"></vxe-column>
</vxe-table>

 


如果是 vxe-grid 高级表格,则使用 children

<vxe-grid :columns="tableColumn" :data="tableData" show-overflow></vxe-grid>

export default {
  data () {
    return {
      tableColumn: [
        { type: 'seq', width: 50 },
        {
          title: '基本信息',
          children: [
            { field: 'name', title: 'Name' },
            {
              title: '其他信息',
              children: [
                { field: 'nickname', title: 'Nickname' },
                { field: 'age', title: 'Age' }
              ]
            },
            { field: 'sex', title: 'Sex' }
          ]
        },
        { field: 'address', title: 'Address', showOverflow: true }
      ],
      tableData: []
    }
  }
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM