gpt4 book ai didi

javascript - vuetify v-data-table 不显示嵌套对象数据

转载 作者:行者123 更新时间:2023-12-02 21:39:03 25 4
gpt4 key购买 nike

我有使用 vuetify 的 v-datatable 我想获取要显示的嵌套数据,不幸的是我无法获取嵌套对象值,这是我的代码

<template slot="items" slot-scope="props">
<tr @click="rowClick(props.item.name)">
<td
class="text-xs-right"
>{{ props.item.firstName + props.item.middleName + props.item.lastName}}</td>
<td class="text-xs-right">{{ props.item.gender }}</td>
<td class="text-xs-right">{{ props.item.dateOfBirth }}</td>
<td class="text-xs-right">{{ props.item }}</td>
</tr>
</template>

这是标题

  headers: [
{
text: "MCN",
align: "left",
sortable: false,
value: "medicalRecordNumber",
width: "16%"
},
{ text: "Full Name", value: "fullName", width: "16%" },
{ text: "Gender", value: "gender", width: "16%" },
{ text: "Date Of Birth", value: "dateOfBirth", width: "16%" },
{ text: "Phone Number", value: "address", width: "16%" },
{ text: "Actions", value: "action", sortable: false }
],

和我的数据

{
"medicalRecordNumber": "dsUlBnusoH",
"fullName": "Rozella SchusterProf. Chloe Hauck DDSAthena Hill III",
"firstName": "Rozella Schuster",
"middleName": "Prof. Chloe Hauck DDS",
"lastName": "Athena Hill III",
"gender": "Female",
"dateOfBirth": "2018-04-18",
"language": "Tigregna",
"religion": "Catholic",
"address": {
"region": "Addis Ababa",
"woreda": "bole",
"kebele": "10",
"houseNumber": "35698",
"telPhoneNumber": null,
"mobilePhoneNumber": null
},
"emergencyContact": {
"firstName": "Krista Collins III",
"middleName": "Onie Roob",
"lastName": "Dr. Vivien Miller PhD",
"emergencyContactAddress": null
}
}

我得到了值,但没有得到它显示的嵌套值[object Object]

最佳答案

替换

{ text: "Phone Number", value: "address", width: "16%" },

{ text: "Phone Number", value: "address.telPhoneNumber", width: "16%" },

关于javascript - vuetify v-data-table 不显示嵌套对象数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60413648/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com