Skip to content

a-table嵌套子表格,子表格数据源为父表格数据源的一个字段 #553

@nbin2008

Description

@nbin2008

请查看 官方组件介绍-表格table,嵌套子表格部分

<template>
  <a-table :columns="columns" :dataSource="data" class="components-table-demo-nested">
    <a slot="operation" slot-scope="text" href="javascript:;">Publish</a>
    <a-table
      slot="expandedRowRender"
      slot-scope="text"
      :columns="innerColumns"
      :dataSource="innerData" // 这里的数据,要为data中某一个数据的一项值,应该如何设置
      :pagination="false"
    >
      <span slot="status" slot-scope="text"> <a-badge status="success" />Finished </span>
      <span slot="operation" slot-scope="text" class="table-operation">
        <a href="javascript:;">Pause</a>
        <a href="javascript:;">Stop</a>
        <a-dropdown>
          <a-menu slot="overlay">
            <a-menu-item>
              Action 1
            </a-menu-item>
            <a-menu-item>
              Action 2
            </a-menu-item>
          </a-menu>
          <a href="javascript:;"> More <a-icon type="down" /> </a>
        </a-dropdown>
      </span>
    </a-table>
  </a-table>
</template>

以上为官方demo,假设data数据中有innerColumns

data = [
  {  
    innerColumns: [
      {},
      {},
    ]
  }
]

请问如何让子table的值: :dataSource="innerData" ,设置为以上数据中的innerColumns,感谢

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions