-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<template> tag with v-for render undefined #4564
Comments
The <template v-for="item in list">
<span>{{ item.key }}</span>
<span> {{ item.name }}</span>
</template> In your case you should simply use |
I know.
and is this the expected behavior? |
It's very weird, indeed. I'll give it a deeper look this afternoon.
…On Mon, 26 Dec 2016, 13:53 wangkehan, ***@***.***> wrote:
I know.
but the real scene in my code is more complex than this demo. I need to
wrap multiple elements in a template tag, but the output is undefined.
and it works all right in v2.1.6.
it seems all v-for directive inside a template tag output undefined if
there's child component with props bind before the tag.
like this:
<component :list="list"></component>
<template v-if="ready">
<div v-for="item of items">{{item.name}}</div> <!--here undefined-->
<!-- ...other -->
</template>
and is this the expected behavior?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#4564 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAoicXh9NnnMTZ8k99ilMF0K4HF7zuArks5rL7iygaJpZM4LVoQP>
.
|
at least the template like:
works wrong. and sometimes the v-for directive inside a template tag also output undefined, and works ok if I modified some code. I really don't know how it happen; |
Does happen in 2.1.7: https://jsfiddle.net/14dtfh51/8/ |
Seems an issue with normalize children. I'll try to make a patch. |
I'm still seeing a similar problem when running against the latest code. Example: https://dankuck.github.io/TiltMaker/buggy.html References: https://cdn.rawgit.com/vuejs/vue/dev/dist/vue.js |
So, what's going on here.. Any updates? |
if there's a bug, please, open a new issue with the corresponding repro |
Any updates regarding this? I am getting the same error. My code is very similar to the first post. |
I finally solved my problem when I realized that I was loading a separate version of Vue on the page. Only the one webpacked into my distribution files was necessary. |
I was facing the same issue, and nothing on here solved it for me (using Vue3) After lot of frustration, I discovered I caused the issue, as I was binding v-for, check your code, it should be I only had to remove the colon |
if i use a Array as a prop of custom component,
the template element with v-for directive just render undefined
it's strange.
only template element tag has this problem.
Vue.js version
2.1.7
Reproduction Link
simple demo here
https://github.com/shjyh/vue_error_demo/tree/master/2016-12-26
The text was updated successfully, but these errors were encountered: