我正在将数组从父组件传递给子组件。正在传递数组,我可以访问整个数组,但是由于某些原因,当我尝试访问数组元素时,我无法访问。
(为简便起见,此名称已缩短)
当我这样做时:
<template v-for="creds in amazonCredsArray">
<v-container fluid grid-list-lg class="come_closer">
<v-layout row wrap>
<v-flex xs12>
<v-card class="lightpurple">
<v-card-title>
<v-icon class="my_dark_purple_text">language</v-icon>
<h1 class="title oswald my_dark_purple_text pl-2 pr-5">ENTER YOUR AMAZON CREDENTIALS BELOW</h1>
</v-card-title>
<v-form ref="form" v-model="valid">
<h1>{{amazonCredsArray}}</h1>
我可以看到显示的amazonCredsArray
。看起来像这样:
[ { "auth_token": "amzn.mws.9cb254dXXXXX", "seller_id": "CXDFDFDF", "marketplace": "asdfasdfasdf", "zones": [ { "name": "United States", "id": 1 } ] }, { "auth_token": "asjdfljakldfjlsadf", "seller_id": "ddeeee", "marketplace": "12", "zones": [ { "name": "United States", "id": 1 } ] } ]
但是,当我尝试在视图中的同一位置使用creds
时,我什么也没得到。我正在尝试:
<template v-for="creds in amazonCredsArray">
<v-container fluid grid-list-lg class="come_closer">
<v-layout row wrap>
<v-flex xs12>
<v-card class="lightpurple">
<v-card-title>
<v-icon class="my_dark_purple_text">language</v-icon>
<h1 class="title oswald my_dark_purple_text pl-2 pr-5">ENTER YOUR AMAZON CREDENTIALS BELOW</h1>
</v-card-title>
<v-form ref="form" v-model="valid">
<h1>{{creds}}</h1>
答案 0 :(得分:0)
尝试一下:
<template v-for="(creds, index) in amazonCredsArray" :key="creds.seller_id">