如何让navie UI中 data-table的树形数据的子节点展开?
<n-data-table
:columns="columns"
:data="data"
:row-key="rowKey"
:loading="dataTableLoading"
class="data-table"
label-field="organName"
key-field="id"
:default-expand-all="true"
/>
<!-- :default-expanded-row-keys="[1]" -->
<!-- default-expand-all -->
const data = ref([]);
const findByIdResult: any = ref({});
getTableList().then((res) => {
data.value = res.rows;
dataTableLoading.value = false;
});
const columns: DataTableColumns<RowData> = [
{
title: '部门名称',
key: 'organName',
},
{
title: '员工数量',
key: 'userCount',
},
{
title: '创建时间',
key: 'ctime',
},
{
title: '操作',
key: 'actions',
render(row) {
return [
h(
NButton,
{
text: true,
type: 'primary',
style: { marginRight: '8px', height: '30px' },
disabled: buttonDisabled.value,
onClick: () => editDepartment(row),
},
{ default: () => '编辑' }
),
h(
NButton,
{
text: true,
type: 'error',
style: { height: '30px' },
disabled: buttonDisabled.value,
onClick: () => delDepartment(row.id),
},
{ default: () => '删除' }
),
];
},
},
];
自己尝试查看组件库但是没有达到理想效果
百度也没有合适的处理方案