<template> tag with v-for render undefined
See original GitHub issueif i use a Array as a prop of custom component, the template element with v-for directive just render undefined
<component :list="list"></component>
<template v-for="item of list">{{item.name}}</template> <!-- output 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
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
VueJS - v-for getting undefined value from props nested object
My component's template and the props are below <template> <div> <label>WorkHours</label> <div v-for="(data, day) in value.config.
Read more >v-for loop rendering keeps throwing 'undefined' error - Laracasts
This is the error: TypeError: Cannot read property 'account' of undefined This is a segment of my html template, the v-for logic:
Read more >Template Syntax | Vue.js
Vue uses an HTML-based template syntax that allows you to declaratively ... or undefined , then the attribute will be removed from the...
Read more >More Ways to a Templates to Vue Components
Render functions return elements that are rendered by Vue. ... All we had to do is include a template tag to render the...
Read more >Adding a new todo form: Vue events, methods, and models
Add a blank <template> and a <script> tag like before: ... Our todo list app rendered with a text input to enter new...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
Github: https://github.com/dankuck/TiltMaker
The
template
tag is meant to wrap multiple elements like:In your case you should simply use
<span v-for="item in list"></span>
to wrap the text nodes