Vuejs - Cannot access array element using v-for in child component
up vote
0
down vote
favorite
I'm passing an array from a parent component to a child. The array is being passed and I can access the entire array, but for some reason when I try and access on array element I can't.
(This is shortened for brevity's sake)
When I do this:
<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>
I can see the amazonCredsArray
displayed.. it looks like this:
[ "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 ] ]
However when I try to use creds
in that same place in the view, I don't get anything. I'm trying this:
<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>
vue.js vuejs2 vue-component
add a comment |
up vote
0
down vote
favorite
I'm passing an array from a parent component to a child. The array is being passed and I can access the entire array, but for some reason when I try and access on array element I can't.
(This is shortened for brevity's sake)
When I do this:
<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>
I can see the amazonCredsArray
displayed.. it looks like this:
[ "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 ] ]
However when I try to use creds
in that same place in the view, I don't get anything. I'm trying this:
<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>
vue.js vuejs2 vue-component
maybe its because your using v-for directive on the root tag. (<template>). its forbidden in vuejs. try wrapping your content in one root element. it should help.
– Efrat
Nov 10 at 22:16
Great thanks.. heck I'll try anything
– ToddT
Nov 10 at 23:00
@Elfrat, root tag(template) can be used with v-for for iteration (vuejs.org/v2/guide/list.html#v-for-on-a-lt-template-gt). Toddt, I created a codepen and it appears to work well. Something else may be blocking or causing the issue
– nara_l
Nov 11 at 2:31
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm passing an array from a parent component to a child. The array is being passed and I can access the entire array, but for some reason when I try and access on array element I can't.
(This is shortened for brevity's sake)
When I do this:
<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>
I can see the amazonCredsArray
displayed.. it looks like this:
[ "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 ] ]
However when I try to use creds
in that same place in the view, I don't get anything. I'm trying this:
<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>
vue.js vuejs2 vue-component
I'm passing an array from a parent component to a child. The array is being passed and I can access the entire array, but for some reason when I try and access on array element I can't.
(This is shortened for brevity's sake)
When I do this:
<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>
I can see the amazonCredsArray
displayed.. it looks like this:
[ "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 ] ]
However when I try to use creds
in that same place in the view, I don't get anything. I'm trying this:
<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>
vue.js vuejs2 vue-component
vue.js vuejs2 vue-component
asked Nov 10 at 21:53
ToddT
6801622
6801622
maybe its because your using v-for directive on the root tag. (<template>). its forbidden in vuejs. try wrapping your content in one root element. it should help.
– Efrat
Nov 10 at 22:16
Great thanks.. heck I'll try anything
– ToddT
Nov 10 at 23:00
@Elfrat, root tag(template) can be used with v-for for iteration (vuejs.org/v2/guide/list.html#v-for-on-a-lt-template-gt). Toddt, I created a codepen and it appears to work well. Something else may be blocking or causing the issue
– nara_l
Nov 11 at 2:31
add a comment |
maybe its because your using v-for directive on the root tag. (<template>). its forbidden in vuejs. try wrapping your content in one root element. it should help.
– Efrat
Nov 10 at 22:16
Great thanks.. heck I'll try anything
– ToddT
Nov 10 at 23:00
@Elfrat, root tag(template) can be used with v-for for iteration (vuejs.org/v2/guide/list.html#v-for-on-a-lt-template-gt). Toddt, I created a codepen and it appears to work well. Something else may be blocking or causing the issue
– nara_l
Nov 11 at 2:31
maybe its because your using v-for directive on the root tag. (<template>). its forbidden in vuejs. try wrapping your content in one root element. it should help.
– Efrat
Nov 10 at 22:16
maybe its because your using v-for directive on the root tag. (<template>). its forbidden in vuejs. try wrapping your content in one root element. it should help.
– Efrat
Nov 10 at 22:16
Great thanks.. heck I'll try anything
– ToddT
Nov 10 at 23:00
Great thanks.. heck I'll try anything
– ToddT
Nov 10 at 23:00
@Elfrat, root tag(template) can be used with v-for for iteration (vuejs.org/v2/guide/list.html#v-for-on-a-lt-template-gt). Toddt, I created a codepen and it appears to work well. Something else may be blocking or causing the issue
– nara_l
Nov 11 at 2:31
@Elfrat, root tag(template) can be used with v-for for iteration (vuejs.org/v2/guide/list.html#v-for-on-a-lt-template-gt). Toddt, I created a codepen and it appears to work well. Something else may be blocking or causing the issue
– nara_l
Nov 11 at 2:31
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Try this out:
<template v-for="(creds, index) in amazonCredsArray" :key="creds.seller_id">
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Try this out:
<template v-for="(creds, index) in amazonCredsArray" :key="creds.seller_id">
add a comment |
up vote
0
down vote
Try this out:
<template v-for="(creds, index) in amazonCredsArray" :key="creds.seller_id">
add a comment |
up vote
0
down vote
up vote
0
down vote
Try this out:
<template v-for="(creds, index) in amazonCredsArray" :key="creds.seller_id">
Try this out:
<template v-for="(creds, index) in amazonCredsArray" :key="creds.seller_id">
answered Nov 11 at 13:05
Daniyal Lukmanov
1810
1810
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243779%2fvuejs-cannot-access-array-element-using-v-for-in-child-component%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
maybe its because your using v-for directive on the root tag. (<template>). its forbidden in vuejs. try wrapping your content in one root element. it should help.
– Efrat
Nov 10 at 22:16
Great thanks.. heck I'll try anything
– ToddT
Nov 10 at 23:00
@Elfrat, root tag(template) can be used with v-for for iteration (vuejs.org/v2/guide/list.html#v-for-on-a-lt-template-gt). Toddt, I created a codepen and it appears to work well. Something else may be blocking or causing the issue
– nara_l
Nov 11 at 2:31