console
new Vue({
el: '#exercise',
data:{
show:true,
exist:true,
numList:[1,3,4,8,2,5,4,6,4,4,7],
bookList:[
{title: 'Lord of the Rings', author: 'J.R.R. Tolkiens', books: '3'}
],
list:{name: 'TESTOBJECT', data: [1.67, 1.33, 0.98, 2.21]}
}
});
<script src="https://npmcdn.com/vue/dist/vue.js"></script>
<div id="exercise">
<div>
<button @click="exist=!exist">Toggle (v-if)</button>
<p v-if="exist">You either see me ...</p>
<p v-else>...or me</p>
<button @click="show=!show">Toggle(v-show)</button>
<p v-show="show">You either see me ...</p>
<p v-show="!show">...or me</p>
</div>
<ul>
<li v-for="(num,index) in numList">{{index}}|{{num}}</li>
</ul>
<ul>
<li v-for="book in bookList">
<span v-for="(value,key,index) in book">{{index}}|{{key}}:{{value}}||</span>
</li>
</ul>
<ul>
<li v-for="item in list">
<template v-if="Array.isArray(item)">
<div v-for="i in item">{{i}} | </div>
</template>
<template v-else>{{item}}</template>
</li>
</ul>
</div>