Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 如何将关联对象数组显示为tbody';在nuxt中的td_Typescript_Vue.js_Vuetify.js_Nuxt.js - Fatal编程技术网

Typescript 如何将关联对象数组显示为tbody';在nuxt中的td

Typescript 如何将关联对象数组显示为tbody';在nuxt中的td,typescript,vue.js,vuetify.js,nuxt.js,Typescript,Vue.js,Vuetify.js,Nuxt.js,我想显示关联对象数组的属性,但我的代码不起作用。 我尝试使用v-for循环,并希望在tbody的td中显示属性信息。 我知道v-data-table的组件包括:项目道具, 如果我使用:我可以显示属性项 将来,我将获取API并显示一些API信息,所以我需要确认如何使用v-for循环。 我已经使用了nuxt.js和vuetify框架以及vue.js 谁能帮帮我 <template> <v-data-table :headers="header" de

我想显示关联对象数组的属性,但我的代码不起作用。 我尝试使用v-for循环,并希望在tbody的td中显示属性信息。 我知道v-data-table的组件包括:项目道具, 如果我使用:我可以显示属性项

将来,我将获取API并显示一些API信息,所以我需要确认如何使用v-for循环。 我已经使用了nuxt.js和vuetify框架以及vue.js

谁能帮帮我

    <template>
  <v-data-table :headers="header" dense class="elevation-1">
    <tbody v-for="customer in customers" :key="customer">
      <tr>
        <td>{{customer.name}}</td>
        <td>{{customer.id}}</td>
        <td>{{customer.age}}</td>
      </tr>
    </tbody>
  </v-data-table>
</template>
<script lang="ts">
import {Component,Vue} from 'nuxt-property-decorator'

@Component
export default class extends Vue{
 header=[
     {text:'name',value:'name'},
     {text:'id',value:'id'},
     {text:'age',value:'age'}
 ]
 customers=[
     {name:'jon',id:1,age:21},
     {name:'dan',id:2,age:23},
     {name:'bob',id:3,age:25},
     {name:'ali',id:4,age:41}

 ]
}
</script>

{{customer.name}
{{customer.id}
{{customer.age}
从“nuxt属性装饰器”导入{Component,Vue}
@组成部分
导出默认类扩展Vue{
标题=[
{文本:'name',值:'name'},
{文本:'id',值:'id'},
{文本:'age',值:'age'}
]
顾客=[
{姓名:'jon',id:1,年龄:21},
{姓名:'dan',身份证号码:2,年龄:23},
{姓名:'bob',id:3,年龄:25},
{姓名:'ali',身份证号码:4,年龄:41}
]
}
如果您想在自定义字段和访问中使用“v-data-table”!您可以使用插槽式链接波纹管:


但也许最好是

我希望这不是打字错误
。。。header=[…
感谢您的回答。它很有效!非常感谢!!