【发布时间】:2019-07-02 02:31:49
【问题描述】:
我有一个 Vuetify 数据表
<v-data-table
:headers="headers"
:items="members"
item-key="id"
v-model="selected"
:search="search"
>
<template slot="items" slot-scope="props">
<tr :active="props.selected" @click="select(props.item)">
<td>{{ props.item.name }}</td>
<td class="text-xs-right">{{ props.item.FirstName}}</td>
<td class="text-xs-right">{{ props.item.LastName }}</td>
<td class="text-xs-right">{{ props.item.email }}</td>
<td class="text-xs-right">{{ props.item.department}}</td>
<td class="text-xs-right">{{ props.item.division}}</td>
</tr>
</template>
当我选择一行时,我希望能够在同一页面上填充一个项目,其中包含一些数据,例如 v-card 中的姓名和电子邮件。我目前有 {{msg}}
在我的脚本中我有
return {
msg: "",
然后
select(selectedItem) {
this.selected = [];
this.members.forEach(item => {
if (item.id == selectedItem.id) {
this.selected.push(item);
this.msg = selectedItem.FirstName;
}
});
},
我需要将名字放入消息中。我觉得我要走很长的路来获取我的数据,并且想知道是否有人有更好的解决方案。感谢您的支持。
【问题讨论】:
标签: vue.js vuetify.js