Answer the question
In order to leave comments, you need to log in
How to v-for in a vue component?
Works:
Vue.component('vue-mark-list', {
template: '<div>{{marks}}</div>',
data: function () {
return {
marks: {
1: 1,
2: 2,
3: 3
}
}
}
});
Vue.component('vue-mark-list', {
template: '<div v-for="mark in marks">{{mark}}</div>',
data: function () {
return {
marks: {
1: 1,
2: 2,
3: 3
}
}
}
});
Answer the question
In order to leave comments, you need to log in
There is no root element in the second template, wrap it in another div:
<div><div v-for="mark in marks">{{mark}}</div></div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question