Vue 2.0 Hello World
by keysl183
HTML
<script src="https://unpkg.com/vue"></script>
<div id="app">
<div v-for="(col, colIndex) in colArray" class="float_lft">
<div v-for="(row, rowIndex) in col">
{{row}}
</div>
</div>
</div>
CSS
.float_lft{
float:left;
margin-right:15px;
}
JavaScript
new Vue({
el: '#app',
data: {
message: 'Hello Vue.js!',
test: ["item1","item2","item3","item4","item5","item6"],
colArray:[],
},
mounted(){
this.fakeFetchData();
},
methods:{
fakeFetchData(){
var cloned = this.test.slice();
console.log(cloned);
while (cloned.length > 0) {
let chunk = cloned.splice(0,4);
this.colArray.push(chunk);
}
console.log(this.colArray);
}
}
})