v-data-table扩展项槽中的父项数据



在扩展项槽中有一个v-data表,用于另一个数据表。我想访问子元素中父元素的ID。我已经在扩展条目槽内使用

进行了测试,在该段落中,我能够显示id。但是,在子数据表中,我不知道如何使用这个值。

<v-data-table
:headers="headers"
:items="financialDocuments"
:single-expand="singleExpand"
item-key="finDocId"
show-expand
>
<template v-slot:expanded-item="{ item }">
<td :colspan="attachmentHeaders.length">
<p>{{item.finDocId}}</p>
<v-data-table
:headers="attachmentHeaders"
:items="item.attachmentPlainDtos"
>
<template v-slot:[`item.attachmentActions`]="{ item }">
<v-icon large @click="removeAttachment(parentItem.Id, item.attachmentId)">
mdi-delete
</v-icon>
</template>
</v-data-table>
</td>            
</template>
</v-data-table>

父项已经可用,只是必须重命名对它的引用,以防止两个"项",一个是父项,一个是子项,并引用正确的项。

<v-data-table
:headers="headers"
:items="financialDocuments"
:single-expand="singleExpand"
item-key="finDocId"
show-expand
>
<template v-slot:expanded-item="{ item: finDoc }">
<td :colspan="attachmentHeaders.length">
<v-data-table
:headers="attachmentHeaders"
:items="finDoc.attachmentPlainDtos"
>
<template v-slot:[`item.attachmentActions`]="{ item }">
<v-icon large @click="removeAttachment(finDoc.Id, item.attachmentId)">
mdi-delete
</v-icon>
</template>
</v-data-table>
</td>            
</template>
</v-data-table>

最新更新