Vue 2.0 Hello World
HTML
<script src="https://unpkg.com/vue"></script>
<div id="app"></div>
JavaScript
new Vue({
el: '#app',
data: {
body: {title : 'test title',
cars: [{make: 'Honda', model: 'Civic', year: 2010},
{make: 'Toyota', model: 'Camry', year: 2012},
{make: 'Nissan', model: 'Versa', year: 2014}]}
},
render: function(h){
let cells = []
for (var i=0; i < this.body.cars.length; i++){
cells.push(h("td", this.body.cars[i].make))
cells.push(h("td", this.body.cars[i].model))
cells.push(h("td", this.body.cars[i].year))
}
let header = h("thead", [h("tr", [h("td", {attrs: {colspan: 5}}, [this.body.title])])])
let body = h("tbody", [h("tr", cells)])
return h("table", [header, body])
}
})