我的数据表组件:
<v-data-table
:headers="headers"
:items="datas"
hide-actions
class="tablazat">
<template
slot="items"
slot-scope="props">
<td>{{ props.item.name }}</td>
<td class="text-xs-right">{{ props.item.city }}</td>
<td class="text-xs-right">{{ props.item.phone }}</td>
<td class="text-xs-right">{{ props.item.birth }}</td>
</template>
</v-data-table>
我的课:
@Component
export default class App extends Vue {
public headers = [
{ text: "Name", value: "name" },
{ text: "City", value: "city" },
{ text: "Phone", value: "phone" },
{ text: "Birth date", value: "birth" }
];
public datas = [
{
name: "Matyas Peter",
city: "Budapest",
phone: "657-976",
birth: "1953"
},
{
name: "Barnabas Hermann",
city: "Budapest",
phone: "226-835",
birth: "1985"
}
];
}
我想将数据从App类传递到数据表。我怎样才能做到这一点?我认为将数据存储在不同的类实例中将是一个不错的解决方案,但是我的代码现在也无法正常工作。什么是最简单的解决方案?
先谢谢您! :)