EMA*_*ade 1 javascript laravel vue.js vuetify.js
我有使用 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>
Run Code Online (Sandbox Code Playgroud)
这是标题
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 }
],
Run Code Online (Sandbox Code Playgroud)
和我的数据
{
"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
}
}
Run Code Online (Sandbox Code Playgroud)
我得到了值,但不是它显示的嵌套值 [object Object]
小智 8
代替
{ text: "Phone Number", value: "address", width: "16%" },
Run Code Online (Sandbox Code Playgroud)
到
{ text: "Phone Number", value: "address.telPhoneNumber", width: "16%" },
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4296 次 |
| 最近记录: |