The very first Vue.js example
HTML
<script src="http://vuejs.org/js/vue.min.js"></script>
<div id="demo">
<p> This does not work with array of onjects </p>
<div v-for="(item, key, index) in rows" >
{{ index }} :: {{ key }} :: {{ item }}
</div>
<p> This Works with object</p>
<div v-for="(item, key, index) in rows[0]" >
{{ index }} :: {{ key }} :: {{ item }}
</div>
</div>
JavaScript
var data = {
message: 'Hello Vue.js!'
}
var demo = new Vue({
el: '#demo',
data: function(){
return {
rows: [
{'id': 123, 'columns': 123 },
{'id': 23, 'columns': 423 }
]
};
}
})